text/plain output for headers

This commit is contained in:
Aleksandar Kostadinov 2017-09-13 18:53:57 +03:00
parent 79d0d7d638
commit a470b9e45d

View file

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