Skip to content
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

Make request.headers avoid rewriting del statements #290

Merged
merged 3 commits into from
Nov 8, 2022

Conversation

UnknownPlatypus
Copy link
Contributor

Similar to what happened in #74, I ran into this issue:

-del request.META["HTTP_REFERER"]
+del request.headers["Referer"]

Which raises: 'HttpHeaders' object does not support item deletion

I guess this is probably an odd pattern but we used it to add a temporary header in a middleware that we wanted to clean at the end. I added a small change to make sure we don't rewrite in that case.

Let me know if it feels right to you.
Cheers

Copy link
Owner

@adamchainz adamchainz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

HISTORY.rst Show resolved Hide resolved
@adamchainz adamchainz changed the title HttpRequest.headers fixer produces invalid del statements Make request.headers avoid rewriting del statements Nov 8, 2022
@adamchainz adamchainz enabled auto-merge (squash) November 8, 2022 20:59
@adamchainz adamchainz merged commit 15dcfa3 into adamchainz:main Nov 8, 2022
@UnknownPlatypus
Copy link
Contributor Author

Nice, thanks for the fast review again !

@UnknownPlatypus UnknownPlatypus deleted the request_headers_delete branch November 8, 2022 21:01
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.

None yet

2 participants