Skip to content

Commit

Permalink
add headers to post requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaracco committed Oct 11, 2016
1 parent d21e322 commit 27c48d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/lol/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def perform_request url, verb = :get, body = {}, options = {}
return JSON.parse(result)
end

params = [:post, :put].include?(verb) ? [url, options.merge({body: body.to_json})] : url
headers = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
params = [:post, :put].include?(verb) ? [url, options.merge({body: body.to_json, headers: headers})] : url
response = self.class.send(verb, *params)
if response.respond_to?(:code) && !(200...300).include?(response.code)
raise NotFound.new("404 Not Found") if response.not_found?
Expand Down

0 comments on commit 27c48d1

Please sign in to comment.