Set the Content-Length on a HEAD requests

We get it as part of the Redis metadata

RFC: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13
This commit is contained in:
Greg Karékinian 2018-05-22 12:44:24 +02:00
parent 28f003c20b
commit b4ad4c4793
2 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,7 @@ module RemoteStorage
server.headers["ETag"] = %Q("#{metadata["e"]}")
server.headers["Last-Modified"] = Time.at(metadata["m"].to_i / 1000).httpdate
server.headers["Content-Type"] = metadata["t"]
server.headers["Content-Length"] = metadata["s"]
if none_match.include? %Q("#{metadata["e"]}")
server.halt 304

View File

@ -616,6 +616,7 @@ shared_examples_for 'a REST adapter' do
last_response.headers["Cache-Control"].must_equal "no-cache"
last_response.headers["Last-Modified"].must_equal "Fri, 04 Mar 2016 12:20:18 GMT"
last_response.headers["Content-Type"].must_equal "text/plain; charset=utf-8"
last_response.headers["Content-Length"].must_equal "2"
end
it "responds with 304 when IF_NONE_MATCH header contains the ETag" do