mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Merge pull request #189 from Sija/patch-2
Override `Content-Type` header key in send_file helper
This commit is contained in:
commit
f6747be691
1 changed files with 1 additions and 1 deletions
|
@ -51,7 +51,7 @@ end
|
||||||
def send_file(env, path : String, mime_type : String? = nil)
|
def send_file(env, path : String, mime_type : String? = nil)
|
||||||
file_path = File.expand_path(path, Dir.current)
|
file_path = File.expand_path(path, Dir.current)
|
||||||
mime_type = "application/octet-stream" unless mime_type
|
mime_type = "application/octet-stream" unless mime_type
|
||||||
env.response.headers.add "Content-Type", mime_type
|
env.response.content_type = mime_type
|
||||||
env.response.content_length = File.size(file_path)
|
env.response.content_length = File.size(file_path)
|
||||||
File.open(file_path) do |file|
|
File.open(file_path) do |file|
|
||||||
IO.copy(file, env.response)
|
IO.copy(file, env.response)
|
||||||
|
|
Loading…
Reference in a new issue