Skip to content

Commit

Permalink
Rebase changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Oct 3, 2024
1 parent c781d67 commit 6b658e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions starlette/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
http_if_range = headers.get("if-range")

if http_range is None or (http_if_range is not None and not self._should_use_range(http_if_range, stat_result)):
await self._handle_simple(send, send_header_only)
await self._handle_simple(scope, send, send_header_only)
else:
try:
ranges = self._parse_range_header(http_range, stat_result.st_size)
Expand All @@ -364,7 +364,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if self.background is not None:
await self.background()

async def _handle_simple(self, send: Send, send_header_only: bool) -> None:
async def _handle_simple(self, scope: Scope, send: Send, send_header_only: bool) -> None:
await send({"type": "http.response.start", "status": self.status_code, "headers": self.raw_headers})
if send_header_only:
await send({"type": "http.response.body", "body": b"", "more_body": False})
Expand Down
1 change: 1 addition & 0 deletions tests/middleware/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@ async def passthrough(request: Request, call_next: RequestResponseEndpoint) -> R
"version": "3",
"method": "GET",
"path": "/",
"headers": [],
"extensions": {"http.response.pathsend": {}},
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ async def send(message: Message) -> None:

# Since the TestClient doesn't support `pathsend`, we need to test this directly.
await app(
{"type": "http", "method": "get", "extensions": {"http.response.pathsend": {}}},
{"type": "http", "method": "get", "headers": [], "extensions": {"http.response.pathsend": {}}},
receive,
send,
)
Expand Down

0 comments on commit 6b658e8

Please sign in to comment.