Leave tmpfile management to OS

This commit is contained in:
Serdar Dogruyol 2017-09-04 17:46:09 +03:00
parent 79e324efaf
commit a1520de7ed
2 changed files with 4 additions and 7 deletions

View file

@ -7,6 +7,10 @@ class HTTP::Request
@override_method ||= check_for_method_override!
end
def content_type
@headers["Content-Type"]?
end
# Checks if method contained in _method param is valid one
def self.override_method_valid?(override_method : String)
return false unless override_method.is_a?(String)

View file

@ -45,7 +45,6 @@ module Kemal
route = context.route_lookup.payload.as(Route)
content = route.handler.call(context)
ensure
remove_tmpfiles(context)
if Kemal.config.error_handlers.has_key?(context.response.status_code)
raise Kemal::Exceptions::CustomException.new(context)
end
@ -53,12 +52,6 @@ module Kemal
context
end
private def remove_tmpfiles(context)
context.params.files.each do |field, file|
File.delete(file.tmpfile.path) if ::File.exists?(file.tmpfile.path)
end
end
private def radix_path(method, path)
"/#{method.downcase}#{path}"
end