#16532 closed Cleanup/optimization (fixed)
Clearer explanation of how the test client expects HTTP headers to be passed
| Reported by: | rbanffy | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | |
| Severity: | Normal | Keywords: | test http host headers |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
During tests (manage.py test), when I pass a "Host" header through the **extra kwarg (see https://docs.djangoproject.com/en/dev/topics/testing/#django.test.client.Client.get) to the get method of the test client, the request handler gets a request object whose get_host method returns "testserver" instead of the string I passed through the Host header. The string is available in request.METAHost
Attachments (1)
Change History (5)
by , 14 years ago
| Attachment: | patch_16532.txt added |
|---|
comment:1 by , 14 years ago
| Component: | Testing framework → Documentation |
|---|---|
| Summary: | django.core.handlers.wsgi.WSGIRequest's get_host doesn't get "Host" header passed to django.test.client.Client.get → Clearer explanation of how the test client expects HTTP headers to be passed |
| Version: | 1.2 |
comment:2 by , 14 years ago
| Has patch: | set |
|---|---|
| Type: | Bug → Cleanup/optimization |
Note:
See TracTickets
for help on using tickets.
Patch adding note on the CGI convention used in headers passed to the test client