text/plain output for headers

This commit is contained in:
Aleksandar Kostadinov 2017-09-13 18:53:57 +03:00
parent 79d0d7d638
commit a470b9e45d
1 changed files with 3 additions and 3 deletions

View File

@ -13,12 +13,12 @@ end
map '/headers' do
headers = proc do |env|
[200, { "Content-Type" => "text/html" }, [
[200, { "Content-Type" => "text/plain" }, [
env.select {|key,val| key.start_with? 'HTTP_'}
.collect {|key, val| [key.sub(/^HTTP_/, ''), val]}
.collect {|key, val| CGI::escapeHTML "#{key}: #{val}"}
.collect {|key, val| "#{key}: #{val}"}
.sort
.join("<br/>\n")
.join("\n")
]]
end
run headers