Select to view content in your preferred language

How can I get the response status code from a QueryTask?

2276
3
Jump to solution
07-12-2016 02:36 PM
WalterMínchez
Deactivated User

Is there any way to have access to the response status and headers from a QueryTask or esriRequest?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
WalterMínchez
Deactivated User

Hi, I found the status code inside esriRequest only, not in a QueryTask.

The code can be checked here: request.ioArgs.xhr.status

var request = esriRequest(...);

request.then( function(response) { /* request.ioArgs.xhr.status */ } );

View solution in original post

3 Replies
ChrisSmith7
Honored Contributor

Just curious, are you needing to add custom headers? If so, check out Insert custom http header into request

Otherwise, are you just needing to inspect for debugging? If that's the case, I'd check out Fiddler - Fiddler free web debugging proxy 

You'll want to make sure you set-up https decryption under options to capture secured traffic, but the Fiddler inspectors will give all of this information - headers and response result.

If you're not looking for either of these, could you provide just a bit more info on what you're hoping to do?

0 Kudos
WalterMínchez
Deactivated User

Hi, is neither of those. What I would like to know if the status code to check if it is 304, not modified.

Using Fiddler I checked that AGS does return this on the QueryTask but in Javascript I cannot see it.

I will use this to update graphics layers and combo boxes only when there is new data.

0 Kudos
WalterMínchez
Deactivated User

Hi, I found the status code inside esriRequest only, not in a QueryTask.

The code can be checked here: request.ioArgs.xhr.status

var request = esriRequest(...);

request.then( function(response) { /* request.ioArgs.xhr.status */ } );