summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2023-04-05 16:22:05 -0700
committerGitHub <noreply@github.com>2023-04-05 16:22:05 -0700
commited6393d66178951c0790de413a5328f279271462 (patch)
tree5ecf8952e08ed0d6ddbe9bd16271388003ef8297
parentaa96bbce86700e8b9255004446a009122a2a9d2a (diff)
parent0fc6fd6b62580006eea8fdac2dc0edb08a7363f1 (diff)
downloadchef-ed6393d66178951c0790de413a5328f279271462.tar.gz
Merge pull request #13663 from chef/jfm/chef18_bug_13446
Correcting a typo in the resource
-rw-r--r--lib/chef/provider/remote_file/http.rb2
-rw-r--r--spec/unit/provider/remote_file/http_spec.rb8
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