This PR closes #97, an issue regarding specifying a custom proxy for node-gcm requests.
Due to a bug with the request module (explained in #97), the initial HTTP CONNECT request never
succeeds.
This commit works around the issue by:
Removing hard-coded declarations of Content-Type and Content-Length headers (request will add them automatically if we supply json payload)
Supply the request body in the json parameter (as an object - not as a JSON-stringified string)
Remove the parseAndRespond function which is no longer needed, as request returns a JSON object (it parses it for us)
Also, lots of tests relied on the way things worked before, with the body parameter, the custom content headers, and our own response JSON parsing. Updated them all, and they all pass.
Changed request.body lookups to request.json (in request options)
This PR closes #97, an issue regarding specifying a custom
proxy
for node-gcm requests.Due to a bug with the
request
module (explained in #97), the initialHTTP CONNECT
request never succeeds.This commit works around the issue by:
Content-Type
andContent-Length
headers (request
will add them automatically if we supplyjson
payload)json
parameter (as an object - not as a JSON-stringified string)parseAndRespond
function which is no longer needed, asrequest
returns a JSON object (it parses it for us)Also, lots of tests relied on the way things worked before, with the
body
parameter, the custom content headers, and our own response JSON parsing. Updated them all, and they all pass.request.body
lookups torequest.json
(in request options)JSON.parse()
the request body anymore