Prevent send_file returning filesize (#344)
Prevent send_file returning filesize
This commit is contained in:
parent
f1edf81d95
commit
48128696c6
2 changed files with 3 additions and 2 deletions
|
@ -88,7 +88,7 @@ describe "Macros" do
|
||||||
response = call_request_on_app(request)
|
response = call_request_on_app(request)
|
||||||
response.status_code.should eq(200)
|
response.status_code.should eq(200)
|
||||||
response.headers["Content-Type"].should eq("application/octet-stream")
|
response.headers["Content-Type"].should eq("application/octet-stream")
|
||||||
response.headers["Content-Length"].should eq("20")
|
response.headers["Content-Length"].should eq("18")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "sends file with given path and given mime-type" do
|
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 = call_request_on_app(request)
|
||||||
response.status_code.should eq(200)
|
response.status_code.should eq(200)
|
||||||
response.headers["Content-Type"].should eq("image/jpeg")
|
response.headers["Content-Type"].should eq("image/jpeg")
|
||||||
response.headers["Content-Length"].should eq("20")
|
response.headers["Content-Length"].should eq("18")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "sends file with binary stream" do
|
it "sends file with binary stream" do
|
||||||
|
|
|
@ -116,6 +116,7 @@ def send_file(env, path : String, mime_type : String? = nil)
|
||||||
IO.copy(file, env.response)
|
IO.copy(file, env.response)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
private def multipart(file, env)
|
private def multipart(file, env)
|
||||||
|
|
Loading…
Reference in a new issue