package pkg import ( "encoding/json" "net/http" ) type HTMxLocation struct { Path string `json:"path"` Target string `json:"target"` } func IsHTMxRequest(r *http.Request) bool { return r.Header.Get("HX-Request") == "true" } func MustMarshalHTMxLocation(location *HTMxLocation) string { data, err := json.Marshal(location) if err != nil { panic(err) } return string(data) }