File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -241,8 +241,13 @@ def []= key, value
241241 'set-cookie' => Header ::SetCookie ,
242242 'cookie' => Header ::Cookie ,
243243
244+ # Date headers:
245+ # These headers include a comma as part of the formatting so they can't be concatenated.
244246 'date' => Header ::Date ,
245247 'expires' => Header ::Date ,
248+ 'last-modified' => Header ::Date ,
249+ 'if-modified-since' => Header ::Date ,
250+ 'if-unmodified-since' => Header ::Date ,
246251 } . tap { |hash | hash . default = Split }
247252
248253 # Delete all headers with the given key, and return the merged value.
Original file line number Diff line number Diff line change 4343 )
4444 end
4545 end
46+
47+ describe Protocol ::HTTP ::Headers do
48+ let ( :headers ) {
49+ subject [ [
50+ [ 'Date' , 'Wed, 21 Oct 2015 07:28:00 GMT' ] ,
51+ [ 'Expires' , 'Wed, 21 Oct 2015 07:28:00 GMT' ] ,
52+ [ 'Last-Modified' , 'Wed, 21 Oct 2015 07:28:00 GMT' ] ,
53+ [ 'If-Modified-Since' , 'Wed, 21 Oct 2015 07:28:00 GMT' ] ,
54+ [ 'If-Unmodified-Since' , 'Wed, 21 Oct 2015 07:28:00 GMT' ]
55+ ] ]
56+ }
57+
58+ it "should parse date headers" do
59+ # When you convert headers into a hash, the policy is applied (i.e. conversion to Date instances):
60+ headers . to_h . each do |key , value |
61+ expect ( value ) . to be_a ( Protocol ::HTTP ::Header ::Date )
62+ end
63+ end
64+ end
4665end
You can’t perform that action at this time.
0 commit comments