mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws&google|storage] properly handle custom headers in mocks
This commit is contained in:
parent
d4d240de31
commit
67d3bade8c
4 changed files with 23 additions and 17 deletions
|
@ -76,12 +76,7 @@ module Fog
|
|||
response.status = 412
|
||||
else
|
||||
response.status = 200
|
||||
response.headers = {
|
||||
'Content-Length' => object['Size'],
|
||||
'Content-Type' => object['Content-Type'],
|
||||
'ETag' => object['ETag'],
|
||||
'Last-Modified' => object['LastModified']
|
||||
}
|
||||
response.headers = object.reject {|key, value| key == :body}
|
||||
unless block_given?
|
||||
response.body = object[:body]
|
||||
else
|
||||
|
|
|
@ -65,13 +65,21 @@ module Fog
|
|||
response.status = 200
|
||||
object = {
|
||||
:body => data[:body],
|
||||
'Content-Type' => data[:headers]['Content-Type'],
|
||||
'Content-Type' => options['Content-Type'] || data[:headers]['Content-Type'],
|
||||
'ETag' => Fog::AWS::Mock.etag,
|
||||
'Key' => object_name,
|
||||
'LastModified' => Fog::Time.now.to_date_header,
|
||||
'Size' => data[:headers]['Content-Length'],
|
||||
'StorageClass' => 'STANDARD'
|
||||
'Size' => options['Content-Length'] || data[:headers]['Content-Length'],
|
||||
'StorageClass' => options['x-amz-storage-class'] || 'STANDARD'
|
||||
}
|
||||
|
||||
for key, value in options
|
||||
case key
|
||||
when 'Cache-Control', 'Content-Disposition', 'Content-Encoding', 'Content-MD5', 'Expires', /^x-amz-meta-/
|
||||
object[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
bucket[:objects][object_name] = object
|
||||
response.headers = {
|
||||
'Content-Length' => object['Size'],
|
||||
|
|
|
@ -73,12 +73,7 @@ module Fog
|
|||
response.status = 412
|
||||
else
|
||||
response.status = 200
|
||||
response.headers = {
|
||||
'Content-Length' => object['Size'],
|
||||
'Content-Type' => object['Content-Type'],
|
||||
'ETag' => object['ETag'],
|
||||
'Last-Modified' => object['LastModified']
|
||||
}
|
||||
response.headers = object.reject {|key, value| key == :body}
|
||||
unless block_given?
|
||||
response.body = object[:body]
|
||||
else
|
||||
|
|
|
@ -59,13 +59,21 @@ module Fog
|
|||
response.status = 200
|
||||
object = {
|
||||
:body => data[:body],
|
||||
'Content-Type' => data[:headers]['Content-Type'],
|
||||
'Content-Type' => options['Content-Type'] || data[:headers]['Content-Type'],
|
||||
'ETag' => Fog::Google::Mock.etag,
|
||||
'Key' => object_name,
|
||||
'LastModified' => Fog::Time.now.to_date_header,
|
||||
'Size' => data[:headers]['Content-Length'],
|
||||
'Size' => options['Content-Length'] || data[:headers]['Content-Length'],
|
||||
'StorageClass' => 'STANDARD'
|
||||
}
|
||||
|
||||
for key, value in options
|
||||
case key
|
||||
when 'Cache-Control', 'Content-Disposition', 'Content-Encoding', 'Content-MD5', 'Expires', /^x-goog-meta-/
|
||||
object[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
bucket[:objects][object_name] = object
|
||||
response.headers = {
|
||||
'Content-Length' => object['Size'],
|
||||
|
|
Loading…
Add table
Reference in a new issue