#33230: Test client doesn't set explicitly provided Content-Type when data is
empty
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Anders
Type: | Kaseorg
Cleanup/optimization | Status: closed
Component: Testing framework | Version: 3.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Lily Foote):
I'm sorry if I'm misunderstanding something here, but doesn't the wontfix
here leave it impossible to test the case where the content type is
explictly set?
Using the example above, both these cases behave the same:
{{{
class MyTest(SimpleTestCase):
def test_content_type(self):
resp = self.client.post("/", data=b"", content_type="application
/octet-stream")
print(resp.content)
# b"{'Cookie': ''}"
def test_no_content_type(self):
resp = self.client.post("/", data=b"")
print(resp.content)
# b"{'Cookie': ''}"
}}}
But it would be useful for the first case to set the content type so we
can test the case where it is present for empty content.
--
Ticket URL: <https://code.djangoproject.com/ticket/33230#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018b82c4698b-68fe0984-9a42-445a-93a9-209a85954f4b-000000%40eu-central-1.amazonses.com.