Skip to content

Commit

Permalink
Hh addfileroute (#705)
Browse files Browse the repository at this point in the history
* change ServersCollection to contain `HTTP.Server`s instead of tasks

* add catch in blocking server

* close the corresponding websocket upon InterruptException

* use forceclose in down() per default

* add kw :named to add_fileroute()
  • Loading branch information
hhaensel authored Feb 19, 2024
1 parent 2111401 commit 4b33353
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Assets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function add_fileroute(assets_config::Genie.Assets.AssetsConfig, filename::Abstr
basedir = pwd(),
type::Union{Nothing, String} = nothing,
content_type::Union{Nothing, Symbol} = nothing,
ext::Union{Nothing, String} = nothing, kwargs...)
ext::Union{Nothing, String} = nothing, named::Union{Symbol, Nothing} = nothing, kwargs...)

file, ex = splitext(filename)
ext = isnothing(ext) ? ex : ext
Expand All @@ -345,7 +345,7 @@ function add_fileroute(assets_config::Genie.Assets.AssetsConfig, filename::Abstr
Symbol("*.*")
end : content_type

Genie.Router.route(Genie.Assets.asset_path(assets_config, type; file, ext, kwargs...)) do
Genie.Router.route(Genie.Assets.asset_path(assets_config, type; file, ext, kwargs...); named) do
Genie.Renderer.WebRenderable(
Genie.Assets.embedded(Genie.Assets.asset_file(cwd=basedir; type, file)),
content_type) |> Genie.Renderer.respond
Expand Down

0 comments on commit 4b33353

Please sign in to comment.