OxygenFramework / Oxygen.jl

💨 A breath of fresh air for programming web apps in Julia
https://oxygenframework.github.io/Oxygen.jl/
MIT License
383 stars 25 forks source link

feature/custom-headers-for-mounted-files #118

Closed ndortega closed 1 year ago

ndortega commented 1 year ago

Related Issue: #111

Here's an example of it in use:

using Oxygen
using HTTP

get("/") do req::HTTP.Request
    return "hello world!"
end

# This function allows us to customize the headers on our static & dynamic resources
function customize_headers(route::String, content_type::String, headers::Vector)
    return [headers; "My-Header" => "hello world!"]
end

staticfiles("content", set_headers=customize_headers)

serve()
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (2a5f807) 97.71% compared to head (7c53c43) 97.72%.

:exclamation: Current head 7c53c43 differs from pull request most recent head 38e43c2. Consider uploading reports for the commit 38e43c2 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #118 +/- ## ======================================= Coverage 97.71% 97.72% ======================================= Files 8 8 Lines 788 790 +2 ======================================= + Hits 770 772 +2 Misses 18 18 ``` | [Impacted Files](https://app.codecov.io/gh/ndortega/Oxygen.jl/pull/118?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nathan+Ortega) | Coverage Δ | | |---|---|---| | [src/core.jl](https://app.codecov.io/gh/ndortega/Oxygen.jl/pull/118?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nathan+Ortega#diff-c3JjL2NvcmUuamw=) | `97.92% <100.00%> (+0.01%)` | :arrow_up: | | [src/fileutil.jl](https://app.codecov.io/gh/ndortega/Oxygen.jl/pull/118?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nathan+Ortega#diff-c3JjL2ZpbGV1dGlsLmps) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.