Investigate a plain net::http client for less dependancies

This commit is contained in:
Dan Milne
2020-01-10 15:37:36 +11:00
parent 49d24cb048
commit 706a9fb377

View File

@@ -98,7 +98,18 @@ module Paapi
headers['Authorization'] = signature.headers['authorization'] headers['Authorization'] = signature.headers['authorization']
headers['Content-Type'] = 'application/json; charset=utf-8' headers['Content-Type'] = 'application/json; charset=utf-8'
Response.new( HTTP.headers(headers).post(endpoint, json: payload ) ) #Response.new( HTTP.headers(headers).post(endpoint, json: payload ) )
request = Net::HTTP::Post.new(endpoint)
request.content_type = 'application/json; charset=UTF-8'
headers.each { |k, v| request[k] = v }
request.body = body
req_options = { use_ssl: uri.scheme == 'https' }
Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
end end
end end