diff --git a/socket/client-js-config.go b/socket/client-js-config.go index c9d7ac7..5fc6428 100644 --- a/socket/client-js-config.go +++ b/socket/client-js-config.go @@ -4,6 +4,7 @@ import ( "embed" "github.com/rs/zerolog/log" "github.com/syntax-framework/chain" + "strconv" ) var ( @@ -22,14 +23,14 @@ func init() { } } -func clientJsAddHandler(router *chain.Router) { +func ClientJsAddHandler(router *chain.Router) { if _, exist := configuredRouterClient[router]; exist { return } router.GET("/chain.js", func(ctx *chain.Context) { ctx.SetHeader("Content-Type", "application/javascript") - // Content-Length + ctx.SetHeader("Content-Length", strconv.Itoa(len(clientJsContent))) // Etag // Last-Modified if _, err := ctx.Write(clientJsContent); err != nil { diff --git a/socket/handler.go b/socket/handler.go index e01a11e..9295462 100644 --- a/socket/handler.go +++ b/socket/handler.go @@ -44,7 +44,7 @@ type Handler struct { func (h *Handler) Configure(router *chain.Router, endpoint string) { - clientJsAddHandler(router) + ClientJsAddHandler(router) if h.Options == nil { h.Options = map[string]any{}