Commit 252cb923 authored by Stan Hu's avatar Stan Hu

Coerce More-Logs-Offset HTTP header value to a string

The Rack spec
(https://github.com/rack/rack/blob/master/SPEC.rdoc#the-headers-)
expects all HTTP header values to be strings; integers are not
allowed. Some Rack servers, such as Thin, fail if you attempt to assign
a integer because they attempt to run string operations (e.g. `chomp`)
on the value.
parent ccd9218a
......@@ -53,7 +53,7 @@ class Projects::RefsController < Projects::ApplicationController
format.json do
logs, next_offset = tree_summary.fetch_logs
response.headers["More-Logs-Offset"] = next_offset if next_offset
response.headers["More-Logs-Offset"] = next_offset.to_s if next_offset
render json: logs
end
......
......@@ -73,7 +73,7 @@ describe Projects::RefsController do
cache_key = "projects/#{project.id}/logs/#{project.commit.id}/#{path}/25"
expect(Rails.cache.fetch(cache_key)).to eq(['logs', 50])
expect(response.headers['More-Logs-Offset']).to eq(50)
expect(response.headers['More-Logs-Offset']).to eq("50")
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment