em_aws 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -117,12 +117,27 @@ module AWS
117
117
  begin
118
118
  http_response = fetch_response(url,method,opts)
119
119
  response.status = http_response.response_header.status.to_i
120
- response.headers = http_response.response_header.raw.to_hash
120
+ response.headers = to_aws_headers(http_response.response_header.raw.to_hash)
121
121
  response.body = http_response.response if response.status < 300
122
122
  rescue *AWS::Core::Http::NetHttpHandler::NETWORK_ERRORS
123
123
  response.network_error = true
124
124
  end
125
125
  end
126
+
127
+ # AWS needs all headers downcased, and for some reason x-amz-expiration and
128
+ # x-amz-restore need to be arrays
129
+ def to_aws_headers(response_headers)
130
+ aws_headers = {}
131
+ response_headers.each_pair do |k,v|
132
+ key = k.downcase
133
+ if (key == "x-amz-expiration" || key == 'x-amz-restore')
134
+ aws_headers[key] = [v]
135
+ else
136
+ aws_headers[key] = v
137
+ end
138
+ end
139
+ response_headers.merge(aws_headers)
140
+ end
126
141
  end
127
142
  end
128
143
  end
@@ -1,3 +1,3 @@
1
1
  module EmAws
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: