bigskysoftware / bigskysoftware/htmx

Request header X-Requested-With: XMLHttpRequest missing

Open
#3,472 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

HTMX ajax requests do not include the `X-Requested-With: XMLHttpRequest` header property, this can have some unforeseen consequences on endpoints that serve different responses when detecting an ajax request, for example `/message/1/` can return a fully rendered site while an ajax request to `/message/1/` might return just the message part.

While this is just one use case, I think it just makes sense that an Ajax request should be able to be recognized as such on the server, afaik there is no way to do this without the X-Requested-With header.

I am using django-htmx, v1.2.6 which uses htmx 2.0.7.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.