diff options
-rw-r--r-- | lib/chef/provider/remote_file/http.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/remote_file/http_spec.rb | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb index 40f64a0e85..ec45b4df59 100644 --- a/lib/chef/provider/remote_file/http.rb +++ b/lib/chef/provider/remote_file/http.rb @@ -113,7 +113,7 @@ class Chef end def last_modified_time_from(response) - response["last_modified"] || response["date"] + response["last-modified"] || response["date"] end def etag_from(response) diff --git a/spec/unit/provider/remote_file/http_spec.rb b/spec/unit/provider/remote_file/http_spec.rb index 8eca721cd0..9a5a25253d 100644 --- a/spec/unit/provider/remote_file/http_spec.rb +++ b/spec/unit/provider/remote_file/http_spec.rb @@ -251,7 +251,7 @@ describe Chef::Provider::RemoteFile::HTTP do end context "and the response has no Date or Last-Modified header" do - let(:last_response) { { "date" => nil, "last_modified" => nil } } + let(:last_response) { { "date" => nil, "last-modified" => nil } } it "does not set an mtime in the result" do # RFC 2616 suggests that servers that do not set a Date header do not # have a reliable clock, so no use in making them deal with dates. @@ -265,19 +265,19 @@ describe Chef::Provider::RemoteFile::HTTP do context "and the response has a Last-Modified header" do let(:last_response) do # Last-Modified should be preferred to Date if both are set - { "date" => "Fri, 17 May 2013 23:23:23 GMT", "last_modified" => "Fri, 17 May 2013 11:11:11 GMT" } + { "date" => "Fri, 17 May 2013 23:23:23 GMT", "last-modified" => "Fri, 17 May 2013 11:11:11 GMT" } end it "sets the mtime to the Last-Modified time in the response" do fetcher.fetch expect(cache_control_data.etag).to be_nil - expect(cache_control_data.mtime).to eq(last_response["last_modified"]) + expect(cache_control_data.mtime).to eq(last_response["last-modified"]) end end context "and the response has a Date header but no Last-Modified header" do let(:last_response) do - { "date" => "Fri, 17 May 2013 23:23:23 GMT", "last_modified" => nil } + { "date" => "Fri, 17 May 2013 23:23:23 GMT", "last-modified" => nil } end it "sets the mtime to the Date in the response" do |