Opened 5 years ago

Closed 5 years ago

Last modified 5 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 Changed 5 years ago by PREMANAND

Owner: changed from nobody to PREMANAND
Status: newassigned

comment:2 Changed 5 years ago by PREMANAND

Has patch: set

comment:4 Changed 5 years ago by Tim Graham

Patch needs improvement: set

comment:5 in reply to:  4 Changed 5 years ago by PREMANAND

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 Changed 5 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In c41fd66f:

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

comment:7 Changed 5 years ago by Tim Graham

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