From bc764b7af7c53b026d6fae6560af4e8e387a3cf3 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol Date: Wed, 16 Nov 2016 22:09:50 +0400 Subject: [PATCH] Treat body as IO in param_parser (#252) --- src/kemal/param_parser.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kemal/param_parser.cr b/src/kemal/param_parser.cr index 0340ba1..69d3adf 100644 --- a/src/kemal/param_parser.cr +++ b/src/kemal/param_parser.cr @@ -64,7 +64,7 @@ module Kemal def parse_json return unless @request.body && @request.headers["Content-Type"]?.try(&.starts_with?(APPLICATION_JSON)) - body = @request.body.as(String) + body = @request.body.to_s case json = JSON.parse(body).raw when Hash json.each do |key, value| @@ -76,7 +76,7 @@ module Kemal end def parse_part(part) - HTTP::Params.parse(part || "") + HTTP::Params.parse(part.to_s || "") end end end