#35414: Issue with AsyncClient ignoring default headers compared to synchronous
Client
-------------------------------------+-------------------------------------
Reporter: 설원준(Wonjoon | Owner: nobody
Seol)/Dispatch squad |
Type: Bug | Status: new
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: AsyncClient, | Triage Stage: Accepted
ASGIRequest |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Carlton Gibson):
This looks correct to me.
The `generic()` method takes in `headers` and `extra` and combines them
before passing on to `_base_scope()`:
{{{
def generic(...):
...
if headers:
extra.update(HttpHeaders.to_asgi_names(headers))
s["headers"] += [
(key.lower().encode("ascii"), value.encode("latin1"))
for key, value in extra.items()
]
return self.request(**s)
}}}
But then `_base_scope()` isn't then correctly setting the `headers` key in
the scope (as reported):
{{{
def _base_scope(..., **request):
...
"headers": [], # <- scope ignores default header
**self.defaults,
**request,
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35414#comment:13>
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/0107018f6104ced3-3888f299-d10d-432d-aaa2-f320a435a719-000000%40eu-central-1.amazonses.com.