Skip to content

String Literals and Headers with HTMX #962

Answered by pharrisee
zthacker asked this question in Q&A
Discussion options

You must be logged in to vote

I'd personally change the hx-headers line to look something more like this:

hx-headers={ fmt.Sprintf(`{"X-CSRF-Token":"%s"}`,csrf)}

String interpolation isn't supported in templ as far as I can see so you'll have to build the string yourself.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zthacker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants