Skip to content

Commit

Permalink
Actually set headers in sinatra routes
Browse files Browse the repository at this point in the history
The headers weren't actually set previously.
The statement `headers = res_headers` doesn't have any effect, since it
only creates a local variable.

Signed-off-by: Alexis Reigel <mail@koffeinfrei.org>
  • Loading branch information
koffeinfrei authored and alexellis committed Oct 13, 2019
1 parent 743b274 commit 16d5e9b
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions template/ruby-http/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,23 @@
get '/*' do
res, res_headers = handler.run request.body, request.env

headers = res_headers

return res
[200, res_headers, res]
end

post '/*' do
res, res_headers = handler.run request.body, request.env
headers = res_headers
return res
res, res_headers = handler.run request.body, request.env

[200, res_headers, res]
end

put '/*' do
res, res_headers = handler.run request.body, request.env
headers = res_headers
res, res_headers = handler.run request.body, request.env

return res
[200, res_headers, res]
end

delete '/*' do
res, res_headers = handler.run request.body, request.env
headers = res_headers
res, res_headers = handler.run request.body, request.env

return res
[200, res_headers, res]
end

0 comments on commit 16d5e9b

Please sign in to comment.