Skip to content

Using nosurf with HTMX's hx-delete #71

@andrewah64

Description

@andrewah64

Hi,

I'm building an app using HTMX that leverages HTMX & the DELETE HTTP request method. I'm passing the csrf token to my backend, for example:

<a href="#" hx-delete="/user/1" hx-vals='{"csrf_token": "AGVpyLkjmMpD9UboB&#43;ybDxGSESY&#43;kFWlwLhyxCCz99WgQAmaHLt/jd4ygvuJLMLnU6bHNbrjhhQMgCzqMDQ5Xg=="}'>Delete</a>

But I'm receiving a 400 response from nosurf. There's no issue if I flip the method to GET or POST.

Can anyone offer any suggestions as to how to make nosurf work with DELETE?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions