From e39770b4339dcd9f35cca14cfb3763bf7557d1e6 Mon Sep 17 00:00:00 2001 From: Alfonso Uceda Pompa Date: Thu, 24 Dec 2015 16:25:00 +0100 Subject: [PATCH 1/2] Make compatyble with crystal 0.10.0 --- src/kemal.cr | 2 +- src/kemal/config.cr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kemal.cr b/src/kemal.cr index d7b6255..31a03bf 100644 --- a/src/kemal.cr +++ b/src/kemal.cr @@ -31,7 +31,7 @@ at_exit do # This route serves the built-in images for not_found and exceptions. get "/__kemal__/:image" do |env| image = env.params["image"] - file_path = File.expand_path("libs/kemal/images/#{image}", Dir.working_directory) + file_path = File.expand_path("libs/kemal/images/#{image}", Dir.current) env.add_header "Content-Type", "application/octet-stream" File.read(file_path) end diff --git a/src/kemal/config.cr b/src/kemal/config.cr index 88eed52..713e3ae 100644 --- a/src/kemal/config.cr +++ b/src/kemal/config.cr @@ -34,10 +34,10 @@ module Kemal # config.yml # public_folder = "root/to/folder" def read_file - path = File.expand_path("config.yml", Dir.working_directory) + path = File.expand_path("config.yml", Dir.current) if File.exists?(path) data = YAML.load(File.read(path)) as Hash - public_folder = File.expand_path("./#{data["public_folder"]}", Dir.working_directory) + public_folder = File.expand_path("./#{data["public_folder"]}", Dir.current) @public_folder = public_folder end end From 8c0ea21d4495065925f0bf79ef671bc1ed9c441e Mon Sep 17 00:00:00 2001 From: Alfonso Uceda Pompa Date: Thu, 24 Dec 2015 17:09:33 +0100 Subject: [PATCH 2/2] return raw json when we parse the request body --- src/kemal/param_parser.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kemal/param_parser.cr b/src/kemal/param_parser.cr index 91c9b07..4d1458b 100644 --- a/src/kemal/param_parser.cr +++ b/src/kemal/param_parser.cr @@ -42,7 +42,7 @@ class Kemal::ParamParser body = @request.body as String - case json = JSON.parse(body) + case json = JSON.parse(body).raw when Hash json.each do |k, v| @params[k as String] = v as AllParamTypes