mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage|aws] more precise mocked get_object
fixes to differentiate between missing bucket and object
This commit is contained in:
parent
72b66750c4
commit
da098b6397
1 changed files with 32 additions and 25 deletions
|
@ -65,7 +65,8 @@ module Fog
|
|||
raise ArgumentError.new('object_name is required')
|
||||
end
|
||||
response = Excon::Response.new
|
||||
if (bucket = self.data[:buckets][bucket_name]) && (object = bucket[:objects][object_name])
|
||||
if (bucket = self.data[:buckets][bucket_name])
|
||||
if (object = bucket[:objects][object_name])
|
||||
if options['If-Match'] && options['If-Match'] != object['ETag']
|
||||
response.status = 412
|
||||
elsif options['If-Modified-Since'] && options['If-Modified-Since'] > Time.parse(object['Last-Modified'])
|
||||
|
@ -96,6 +97,12 @@ module Fog
|
|||
end
|
||||
else
|
||||
response.status = 404
|
||||
response.body = "...<Code>NoSuchKey<\/Code>..."
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
end
|
||||
else
|
||||
response.status = 404
|
||||
response.body = "...<Code>NoSuchBucket</Code>..."
|
||||
raise(Excon::Errors.status_error({:expects => 200}, response))
|
||||
end
|
||||
response
|
||||
|
|
Loading…
Reference in a new issue