only return strings from routes fixes #374 (#408)

This commit is contained in:
Cris Ward 2017-10-02 21:47:43 +01:00 committed by Serdar Dogruyol
parent 8cf3f67594
commit 30bdcc9759
2 changed files with 12 additions and 1 deletions

View file

@ -8,7 +8,8 @@ module Kemal
def initialize(@method : String, @path : String, &handler : HTTP::Server::Context -> _)
@handler = ->(context : HTTP::Server::Context) do
handler.call(context).to_s
output = handler.call(context)
output.is_a?(String) ? output : ""
end
end
end