As discussed in #179, we'd like developers to be able to set all request options externally, by providing an object to the gcm.Sender() constructor, such as the request proxy, timeout, strictSSL, etc.
Changes:
Require lodash
Removed manual checks for proxy, maxSockets, timeout, and
strictSSL request options
Added a variable sender_options that contains the request options passed to gcm.Sender()
Added a variable request_options which uses Lodash's _.defaults() function to prevent overriding our internal options with
externally-provided ones
Allow overriding timeout externally if provided, if not, use Constants.SOCKET_TIMEOUT (same as old behavior)
Modified post_req to use the request_options instead of the old post_options which was manually constructed
Checked and works. Ran npm test successfully. External options do not override (except timeout and new headers)
As discussed in #179, we'd like developers to be able to set all request options externally, by providing an object to the
gcm.Sender()
constructor, such as the request proxy, timeout, strictSSL, etc.Changes:
lodash
proxy
,maxSockets
,timeout
, andstrictSSL
request optionssender_options
that contains the request options passed to gcm.Sender()request_options
which uses Lodash's_.defaults()
function to prevent overriding our internal options with externally-provided onestimeout
externally if provided, if not, useConstants.SOCKET_TIMEOUT
(same as old behavior)post_req
to use therequest_options
instead of the oldpost_options
which was manually constructedChecked and works. Ran
npm test
successfully. External options do not override (excepttimeout
and newheaders
)Closes #179.