Merge pull request #37 from AlfonsoUceda/master
Make compatyble with crystal 0.10.0
This commit is contained in:
commit
15fabafe68
3 changed files with 4 additions and 4 deletions
|
@ -31,7 +31,7 @@ at_exit do
|
||||||
# This route serves the built-in images for not_found and exceptions.
|
# This route serves the built-in images for not_found and exceptions.
|
||||||
get "/__kemal__/:image" do |env|
|
get "/__kemal__/:image" do |env|
|
||||||
image = env.params["image"]
|
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"
|
env.add_header "Content-Type", "application/octet-stream"
|
||||||
File.read(file_path)
|
File.read(file_path)
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,10 +34,10 @@ module Kemal
|
||||||
# config.yml
|
# config.yml
|
||||||
# public_folder = "root/to/folder"
|
# public_folder = "root/to/folder"
|
||||||
def read_file
|
def read_file
|
||||||
path = File.expand_path("config.yml", Dir.working_directory)
|
path = File.expand_path("config.yml", Dir.current)
|
||||||
if File.exists?(path)
|
if File.exists?(path)
|
||||||
data = YAML.load(File.read(path)) as Hash
|
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
|
@public_folder = public_folder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Kemal::ParamParser
|
||||||
|
|
||||||
body = @request.body as String
|
body = @request.body as String
|
||||||
|
|
||||||
case json = JSON.parse(body)
|
case json = JSON.parse(body).raw
|
||||||
when Hash
|
when Hash
|
||||||
json.each do |k, v|
|
json.each do |k, v|
|
||||||
@params[k as String] = v as AllParamTypes
|
@params[k as String] = v as AllParamTypes
|
||||||
|
|
Loading…
Reference in a new issue