Prevent send_file returning filesize (#344)

Prevent send_file returning filesize
This commit is contained in:
Cris Ward 2017-03-29 13:09:25 +01:00 committed by Serdar Dogruyol
parent f1edf81d95
commit 48128696c6
2 changed files with 3 additions and 2 deletions

View file

@ -88,7 +88,7 @@ describe "Macros" do
response = call_request_on_app(request)
response.status_code.should eq(200)
response.headers["Content-Type"].should eq("application/octet-stream")
response.headers["Content-Length"].should eq("20")
response.headers["Content-Length"].should eq("18")
end
it "sends file with given path and given mime-type" do
@ -100,7 +100,7 @@ describe "Macros" do
response = call_request_on_app(request)
response.status_code.should eq(200)
response.headers["Content-Type"].should eq("image/jpeg")
response.headers["Content-Length"].should eq("20")
response.headers["Content-Length"].should eq("18")
end
it "sends file with binary stream" do

View file

@ -116,6 +116,7 @@ def send_file(env, path : String, mime_type : String? = nil)
IO.copy(file, env.response)
end
end
return
end
private def multipart(file, env)