Skip to content

Commit

Permalink
Fixed TestClient error when response headers missing (#1200)
Browse files Browse the repository at this point in the history
* Fixed abersheeran/asgi-ratelimit#14

* lint it

* Black it

Co-authored-by: euri10 <euri10@users.noreply.github.com>
  • Loading branch information
abersheeran and euri10 committed Jun 21, 2021
1 parent ab0fff9 commit 7ed2890
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion starlette/testclient.py
Expand Up @@ -214,7 +214,8 @@ async def send(message: Message) -> None:
raw_kwargs["status"] = message["status"]
raw_kwargs["reason"] = _get_reason_phrase(message["status"])
raw_kwargs["headers"] = [
(key.decode(), value.decode()) for key, value in message["headers"]
(key.decode(), value.decode())
for key, value in message.get("headers", [])
]
raw_kwargs["preload_content"] = False
raw_kwargs["original_response"] = _MockOriginalResponse(
Expand Down

0 comments on commit 7ed2890

Please sign in to comment.