-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solveRoute
throws error when used with rawResponse
#1045
Comments
Just saw you were working on the issue, while I wrote this message. Great! Hi, we saw, that not only This structure causes someone to receive a different json response, when using Suggestion: Monkey patch
|
Thanks for calling to attention the other places like originDestinationMatrix and bulkGeocode .... we'll have to do the same thing as #1046 in those, or think of a better way to handle these cases holistically. |
@wsvoja it seems like
If you have a replication case to show it not working, please provide. Otherwise we'll move forward with the PR for the fix for |
Hi, thank you for working on that. However, the fix doesn't allow me to call The line This is what I wanted to point out in my second comment and this problem also applies to There might be other alternatives to this approach, such as by adding a method Thank you and best regards. |
Hi @wsvoja, thanks for the message. Could you please explain more about your use case of why you want to access the |
Hi Gavin, sorry for my late response. In our use case, we want to access the HTTP Reponse Headers, especially the cache information. Both Json objects are different, since the response object is altered at multiple places, e.g. coordinates are converted with Therefore our application has to deal with two different kinds of responses, which could be aligned easily by calling I could even be, that the raw response Json might not fit the documented schema, https://esri.github.io/arcgis-rest-js/api/routing/ISolveRouteResponse/#routes says I hope I could explain the situation well enough. Thank you and best regards |
Description
Hi,
we are using the function
solveRoute
in conjuction with therawResponse=true
.We observed, that this throws an error and looking closer, we found that
solveRoute
callscleanResponse
in thethen
section after the request was sent.https://github.com/Esri/arcgis-rest-js/blob/3.x/packages/arcgis-rest-routing/src/solveRoute.ts#L136
The
json()
method wasn't yet called on this response object, and therefore the propertyroute
doesn't exist in the response object.It is accessed however in https://github.com/Esri/arcgis-rest-js/blob/3.x/packages/arcgis-rest-routing/src/solveRoute.ts#L161 which throws the error.
This behavior seems to be applicable for at least version 3.X.X and 4.X.X.
Reproduction
rawResponse: true
during the creation.catch()
block after the callsolveRoute
will not resolve, it will enter the catch blockLogs
No response
System Info
@esri/arcgis-rest-routing: "^3.5.1"
Additional Information
No response
The text was updated successfully, but these errors were encountered: