Skip to content

Remove rawResponse support from REST JS packages#1326

Open
dixonyant wants to merge 21 commits into
appendCustomParams-updatefrom
updatepackagestorequestoptions
Open

Remove rawResponse support from REST JS packages#1326
dixonyant wants to merge 21 commits into
appendCustomParams-updatefrom
updatepackagestorequestoptions

Conversation

@dixonyant

@dixonyant dixonyant commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

This PR propagates the recent rawResponse deprecation changes across the library. rawResponse is no longer supported in requestOptions in request() and users must now use rawRequest() to get native responses.
This PR also updates the library to use the new IRequestOptions shape fetchOptions object instead of legacy properties.

This change will allow for consistent and guaranteed return types across any wrapper functions that call request. This change also guarantees that all request responses return as json. This PR drops support for requestOptions.rawResponse across REST JS.

Users will be able to get native responses through raw versions of wrapper methods like getItemDataRaw() or queryFeaturesRaw() and parse the response themselves. Format params that are not json (like f=pbf or binary return types like blob or text) will need to use methods that wrap rawRequest() and support those format types separately.

Breaking Changes

Query

  • getFeature() no longer supports raw response.
  • queryFeatures() can no longer be used to query features as pbf with f=pbf.

Geocode

  • bulkGeocode() no longer supports raw response.
  • geocode() no longer supports raw response.

Get

  • getItemData() no longer supports raw, file, or binary responses, use getItemDataRaw()instead.
  • deprecated IItemDataOptions since we don't support the file property in getItemData() anymore. Use getItemDataRaw() to get the native response instead.
  • getItemInfo() no longer supports rawResponse as an option and uses rawRequest() as default behavior.
  • getItemResource() no longer supports rawResponse as an option and uses rawRequest() as default behavior.

Added Behavior

Query

  • Added queryFeaturesRaw() to allow users to query features as a raw response and use format params including f=pbf or non-json types.

Get

  • Added getItemDataRaw() to allow users to handle non-json data manually.

@previnWong

previnWong commented Jun 26, 2026

Copy link
Copy Markdown

@dixonyant

Right now we have rawResponse as true in this case.
image

Request is imported from @esri/arcgis-rest-request

Do I need to update this? looks like I need to use rawRequest?

@dixonyant dixonyant marked this pull request as ready for review June 30, 2026 23:13
@dixonyant dixonyant changed the base branch from v5.0.0 to main June 30, 2026 23:23
@dixonyant dixonyant changed the base branch from main to v5.0.0 June 30, 2026 23:23
@dixonyant dixonyant changed the base branch from v5.0.0 to appendCustomParams-update June 30, 2026 23:24
@dixonyant dixonyant requested a review from patrickarlt July 1, 2026 15:35

@dixonyant dixonyant left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrickarlt i tagged each of the changes with the comments on the previous pr #1317 feedback, although there were more changes here. This pr should be the one that covers or finishes everything related to rawResponse for v5. most raw response support has been dropped except for queryFeaturesRaw() and getItemDataRaw() for now. Others can be added later with better typed support. processOptions and typed methods are coming next.

}
};

if (options.file) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing options.file here and deprecating the interface that uses it to resolve comment here: #1317 (comment)

they can use getItemDataRaw() and parse the response.blob() themselves

}
}

if (typeof address !== "string" && address.rawResponse) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addresses #1317 (comment)

);
}

if (options.rawResponse) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addresses #1317 (comment)

/**
* Response format. Defaults to "json"
* NOTE: for "pbf" you must use the method `rawRequest()`
* NOTE: for "f=pbf" you must use the method `queryFeaturesRaw()`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address feedback in #1317 (comment)

...requestOptions.fetchOptions
}
};
if (options.rawResponse) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addresses #1317 (comment)

queryOptions.params?.f === "pbf-as-arcgis"
) {
return queryPbfAsGeoJSONOrArcGIS(requestOptions.url, queryOptions);
} else if (queryOptions.params?.f === "pbf") {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing pbf from queryFeatures() to address #1317 (comment) and users can use queryFeaturesRaw() in the case they want to use a native response or native response with pbf

objectIds?: number[];
}

export interface IQueryFeaturesRawOptions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulling out this options construction code shared between queryFeatures and queryFeaturesRaw

}
);

queryOptions.fetchOptions = {

@dixonyant dixonyant Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to allow users to override or should this always be "GET" for query? @patrickarlt

}
);

options.fetchOptions = {

@dixonyant dixonyant Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to allow users to override or should this always be "GET" for queryRelated? @patrickarlt

expect(rawBuffer.byteLength).toBe(443);
});

test("queryFeatures with f=pbf should warn, but will query json and return typed json for f=pbf queries", async () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test case showing if users try and force a pbf request to request they will be warned as unsupported and will still get json

}
};

options.params.f = null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving this here for functional equivalence. What about f=zip? https://developers.arcgis.com/rest/users-groups-and-items/item-data/

@patrickarlt

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
arcgis-rest-basemap-sessions.src 100% 100% 0
arcgis-rest-basemap-sessions.src.utils 100% 100% 0
arcgis-rest-demographics.src 100% 100% 0
arcgis-rest-developer-credentials.src 100% 100% 0
arcgis-rest-developer-credentials.src.shared 100% 100% 0
arcgis-rest-elevation.src 100% 100% 0
arcgis-rest-feature-service.src 100% 100% 0
arcgis-rest-feature-service.src.pbf-parser 100% 100% 0
arcgis-rest-geocoding.src 100% 100% 0
arcgis-rest-places.src 100% 100% 0
arcgis-rest-portal.src.groups 100% 100% 0
arcgis-rest-portal.src.items 100% 100% 0
arcgis-rest-portal.src.orgs 100% 100% 0
arcgis-rest-portal.src.services 100% 100% 0
arcgis-rest-portal.src.sharing 100% 100% 0
arcgis-rest-portal.src.users 100% 100% 0
arcgis-rest-portal.src.util 100% 100% 0
arcgis-rest-request.src 100% 100% 0
arcgis-rest-request.src.types 100% 100% 0
arcgis-rest-request.src.utils 100% 100% 0
arcgis-rest-routing.src 100% 100% 0
Summary 100% (2484 / 2484) 100% (1327 / 1327) 0

Minimum allowed line rate is 100%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants