starlette
starlette copied to clipboard
The little ASGI framework that shines. 🌟
Thought of this while working on related work to #1691. Sorry if this has already been proposed, I know we've gone around a couple times with similar stuff. Background: -...
Based on many previous discussions, I am proposing that we deprecate `BaseHTTPMiddleware`. We'll put a deprecation warning in the constructor. In this warning we will give: - Some background on...
When a websocket connection is rejected (e.g., wrong URL, missing permissions, etc), starlette always returns a generic 403 response (triggered by "websocket.close" message) or a generic HTTP500 response (Produced by...
Fixes #1634 - Discussion #1527 - Caused by #1157 `await recv_stream.receive()` will raise `anyio.EndOfStream` if request is disconnected, due to: - `task_group.cancel_scope.cancel()` in `StreamingResponse.__call__..wrap` and - cancellation check in `await...
Fixes #1634 - Discussion #1527 - Caused by #1157 `RuntimeError: No response returned.` is raised in `BaseHTTPMiddleware` if request is disconnected, due to `task_group.cancel_scope.cancel()` in `StreamingResponse.__call__..wrap` and cancellation check in...
I think this addresses https://github.com/tiangolo/fastapi/issues/953. Thank you @smagafurov for the link in https://github.com/tiangolo/fastapi/issues/953#issuecomment-730302314 ## What does this do for users? This fixes a confusing behavior where their endpoint works differently...
``` from starlette.applications import Starlette from starlette.requests import Request from starlette.responses import PlainTextResponse from starlette.middleware.base import BaseHTTPMiddleware class SampleMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next): _ = await request.form() return...
### Checklist - [X] The bug is reproducible against the latest release or `master`. - [X] There are no similar issues or pull requests to fix it yet. ### Describe...
Refs #1678, cc @adriangb I experimented with what a helper middleware to do some simple request/response peeks and edits might look like, and yet be pure ASGI -- no Starlette...
- Replaces #527 ## Missing - [ ] Address what @tomchristie said on https://github.com/encode/starlette/pull/527#discussion_r343613065: - [ ] Check how this PR works interacting with the server.