1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Use correct Content-Type

This commit is contained in:
jc00ke 2012-04-29 12:24:00 -07:00
parent ede98dadfd
commit 29a71026f1

View file

@ -17,7 +17,7 @@ module Puma
def call(env)
unless authenticate(env)
return rack_response(403, "Invalid auth token")
return rack_response(403, 'Invalid auth token', 'text/plain')
end
case env['PATH_INFO']
@ -44,12 +44,12 @@ module Puma
return rack_response(200, %Q!{ "backlog": #{b}, "running": #{r} }!)
end
rack_response 404, "Unsupported action"
rack_response 404, "Unsupported action", 'text/plain'
end
private
def rack_response(status, body)
[status, { 'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }, [body]]
def rack_response(status, body, content_type='application/json')
[status, { 'Content-Type' => content_type, 'Content-Length' => body.length.to_s }, [body]]
end
end
end