1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Add support in Fog::AWS.signed_params_v4 to sign requests with query params and body

This commit is contained in:
Miguel Landaeta 2015-06-22 20:58:40 -03:00
parent e4b3aa377a
commit 6ce85f63bb

View file

@ -148,7 +148,9 @@ module Fog
headers = headers.merge('Host' => options[:host], 'x-amz-date' => date.to_iso8601_basic)
headers['x-amz-security-token'] = options[:aws_session_token] if options[:aws_session_token]
query = options[:query] || {}
if !options[:body]
body = ''
for key in params.keys.sort
unless (value = params[key]).nil?
@ -156,8 +158,11 @@ module Fog
end
end
body.chop!
else
body = options[:body]
end
headers['Authorization'] = options[:signer].sign({:method => options[:method], :headers => headers, :body => body, :query => {}, :path => options[:path]}, date)
headers['Authorization'] = options[:signer].sign({:method => options[:method], :headers => headers, :body => body, :query => query, :path => options[:path]}, date)
return body, headers
end