Skip to content

Commit

Permalink
Ajuste endpoint de chain.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nidorx committed Apr 12, 2023
1 parent 795f45d commit c1612b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions socket/client-js-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"embed"
"github.com/rs/zerolog/log"
"github.com/syntax-framework/chain"
"strconv"
)

var (
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion socket/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit c1612b9

Please sign in to comment.