Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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.encoding to 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 PREMANAND, 8 years ago

Owner: changed from nobody to PREMANAND
Status: newassigned

comment:2 by PREMANAND, 8 years ago

Has patch: set

comment:4 by Tim Graham, 8 years ago

Patch needs improvement: set

in reply to:  4 comment:5 by PREMANAND, 8 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:6 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In c41fd66f:

Fixed #27113 -- Tested that setting HttpRequest.encoding clears POST.

comment:7 by Tim Graham, 8 years ago

Summary: Add tests for setting HttpRequest.encodingTest that setting HttpRequest.encoding clears POST

I created #27156 for the follow up ticket.

Note: See TracTickets for help on using tickets.
Back to Top