mirror of
https://github.com/lus/pasty.git
synced 2023-08-10 21:13:09 +03:00
Force specific Content-Type value for JS (#6)
This commit is contained in:
parent
542bb5b17d
commit
5f7df183b4
@ -31,6 +31,9 @@ func Serve() error {
|
|||||||
router.GET("/{path:*}", func(ctx *fasthttp.RequestCtx) {
|
router.GET("/{path:*}", func(ctx *fasthttp.RequestCtx) {
|
||||||
path := string(ctx.Path())
|
path := string(ctx.Path())
|
||||||
if !strings.HasPrefix(path, "/api") && (strings.Count(path, "/") == 1 || strings.HasPrefix(path, "/assets")) {
|
if !strings.HasPrefix(path, "/api") && (strings.Count(path, "/") == 1 || strings.HasPrefix(path, "/assets")) {
|
||||||
|
if strings.HasPrefix(path, "/assets/js/") {
|
||||||
|
ctx.SetContentType("text/javascript")
|
||||||
|
}
|
||||||
frontend(ctx)
|
frontend(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user