1
0
Fork 0
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:
geemus 2011-06-07 18:46:37 -07:00
parent 72b66750c4
commit da098b6397

View file

@ -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