Skip to content

fix: handle HEAD requests like GET in generic_views #2015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2025

Conversation

janheini
Copy link
Contributor

As mentioned in #1956, the generic views break when handling a HEAD request, since data from request.GET is only added if request.method == "GET". Since request.GET can also be used when the method is HEAD we can just treat them the same.

The issue can be reproduced simply by changing the request method in test_generic_views.py and running the tests. I have added this as a new test case.

Fixes #1956

I'm open for feedback if you prefer a different solution.

Thank you!
Jan

HEAD requests caused an exception before. Handle them like GET requests.

Fixes django-haystack#1956
@acdha acdha merged commit c96b4e1 into django-haystack:master Aug 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic view does not support the "HEAD" method.
2 participants