Closed
Description
When HTTParty was replaced with Faraday (in #55) some HTTParty options were converted to constants (https://github.com/decision-labs/fcm/pull/55/files#diff-0068abed920b95db498a1c507ae5a10f86145599f5dd2431b36ccbf492d7fe7dL6-L10)
DEFAULT_TIMEOUT
and FORMAT
are now unused.
It would be great to pass DEFAULT_TIMEOUT
as an option to Faraday, example:
def for_uri(uri, extra_headers = {})
connection = ::Faraday.new(:url => uri) do |faraday|
faraday.adapter Faraday.default_adapter
faraday.options["timeout"] = DEFAULT_TIMEOUT
faraday.headers["Content-Type"] = "application/json"
faraday.headers["Authorization"] = "key=#{api_key}"
extra_headers.each do |key, value|
faraday.headers[key] = value
end
end
yield connection
end
A bonus would be to allow some way for consumers of FCM
to be able to pass options like this in when initializing and have them passed to the underlying HTTP library.
Metadata
Metadata
Assignees
Labels
No labels