node-gcm icon indicating copy to clipboard operation
node-gcm copied to clipboard

Gcm 302 error

Open guytuboul opened this issue 10 years ago • 2 comments

Hey, I saw recently that the library return an error with 302,meaning 'Found' and this is a common way of performing URL redirection. Is this library support such response from gcm? Thanks, guy

guytuboul avatar Mar 18 '15 16:03 guytuboul

You are correct, currently anything other than a code 200 is treated as an error.

From W3Cs documentation on status codes:

The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. [...] If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

We send POST requests, so I am assuming that we shouldn't use the alternate URL (given in the Location header).

I have not experienced this issue, but I would be very interested in details on how to handle it.

hypesystem avatar Mar 19 '15 09:03 hypesystem

This seems to be a previously reported issue (with GCM):

  • https://groups.google.com/forum/#!topic/android-gcm/WwEg6buc-K0
  • http://stackoverflow.com/questions/15037454/io-exception-while-accessing-google-cloud-message

I don't see any documentation on how to handle it. I assume we could just re-run the request to the provided (temporary, alternate) URL, but I would like confirmation of this.

hypesystem avatar Mar 19 '15 09:03 hypesystem