mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[fix] Corrected the service mocks for testing to respond with a 304 to values of If-Modified-Since that match Last-Modified
The HTTP spec suggests that clients supply the value of Last-Modified that they previously received from the server to If-Modified-Since. When comparing If-Modified-Since > Last-Modified, however, the Mock object would fail to return a 304 for such a case.
This commit is contained in:
parent
a23d615ad5
commit
47547e42ef
4 changed files with 4 additions and 4 deletions
|
@ -87,7 +87,7 @@ module Fog
|
|||
if (object && !object[:delete_marker])
|
||||
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'])
|
||||
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
|
||||
response.status = 304
|
||||
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
|
||||
response.status = 304
|
||||
|
|
|
@ -73,7 +73,7 @@ module Fog
|
|||
if (bucket = self.data[:buckets][bucket_name]) && (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'])
|
||||
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
|
||||
response.status = 304
|
||||
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
|
||||
response.status = 304
|
||||
|
|
|
@ -43,7 +43,7 @@ module Fog
|
|||
if (object = container[: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'])
|
||||
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
|
||||
response.status = 304
|
||||
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
|
||||
response.status = 304
|
||||
|
|
|
@ -78,7 +78,7 @@ module Fog
|
|||
if (object && !object[:delete_marker])
|
||||
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'])
|
||||
elsif options['If-Modified-Since'] && options['If-Modified-Since'] >= Time.parse(object['Last-Modified'])
|
||||
response.status = 304
|
||||
elsif options['If-None-Match'] && options['If-None-Match'] == object['ETag']
|
||||
response.status = 304
|
||||
|
|
Loading…
Reference in a new issue