Skip to content

Commit

Permalink
fix: ignore errors from json generation
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Aug 21, 2024
1 parent 4c9f049 commit 3823273
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions attrib.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"

"github.com/zeiss/pkg/conv"
"github.com/zeiss/pkg/errorx"
)

// HxEventType represents the type of htmx event.
Expand Down Expand Up @@ -183,9 +184,7 @@ func HxInclude(target string) Node {

// HxHeaders sets the hx-headers attribute to specify the headers for the request.
func HxHeaders(headers map[string]string) Node {
b, _ := json.Marshal(headers)

return Attribute("hx-headers", string(b))
return Attribute("hx-headers", string(errorx.Ignore(json.Marshal(headers))))
}

// Async sets the async attribute for script elements.
Expand Down

0 comments on commit 3823273

Please sign in to comment.