#27113 closed Cleanup/optimization (fixed)
Test that setting HttpRequest.encoding clears POST
| Reported by: | Tim Graham | Owned by: | PREMANAND |
|---|---|---|---|
| Component: | HTTP handling | Version: | 1.10 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
Looking at Django's coverage report, I found some untested lines: https://github.com/django/django/blob/bc1e2d8e8edde6cc7d2657c68242a13ee65a15b8/django/http/request.py#L227-L231. Removing them doesn't cause any tests to fail.
A test should be added to demonstrate the documented behavior:
You can write to
HttpRequest.encodingto change the encoding used when accessing the form data. Any subsequent attribute accesses (such as reading from GET or POST) will use the new encoding value.
The test might look similar the following test, but should use a value that appears differently after the encoding changes:
https://code.djangoproject.com/attachment/ticket/27107/27107-test.diff
Change History (7)
comment:1 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 9 years ago
| Has patch: | set |
|---|
comment:3 by , 9 years ago
follow-up: 5 comment:4 by , 9 years ago
| Patch needs improvement: | set |
|---|
comment:5 by , 9 years ago
Replying to timgraham:
Fixed all the issues and included test for POST request. As mentioned earlier, GET as a different problem and will open a different ticket to track it.
https://github.com/django/django/pull/7185
comment:7 by , 9 years ago
| Summary: | Add tests for setting HttpRequest.encoding → Test that setting HttpRequest.encoding clears POST |
|---|
I created #27156 for the follow up ticket.
https://github.com/django/django/pull/7179