Skip to content

Commit 65bfd74

Browse files
authored
Version 0.39.0 (#2699)
1 parent 69ed26a commit 65bfd74

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

docs/release-notes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ hide: navigation
33
toc_depth: 2
44
---
55

6+
## 0.39.0 (September 23, 2024)
7+
8+
#### Added
9+
10+
* Add support for [HTTP Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) to
11+
`FileResponse` [#2697](https://github.com/encode/starlette/pull/2697).
12+
613
## 0.38.6 (September 22, 2024)
714

815
#### Fixed

docs/responses.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,16 @@ async def app(scope, receive, send):
183183
await response(scope, receive, send)
184184
```
185185

186+
File responses also supports [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).
187+
188+
The `Accept-Ranges: bytes` header will be included in the response if the file exists. For now, only the `bytes`
189+
range unit is supported.
190+
191+
If the request includes a `Range` header, and the file exists, the response will be a `206 Partial Content` response
192+
with the requested range of bytes. If the range is invalid, the response will be a `416 Range Not Satisfiable` response.
193+
186194
## Third party responses
187195

188196
#### [EventSourceResponse](https://github.com/sysid/sse-starlette)
189197

190198
A response class that implements [Server-Sent Events](https://html.spec.whatwg.org/multipage/server-sent-events.html). It enables event streaming from the server to the client without the complexity of websockets.
191-
192-
#### [baize.asgi.FileResponse](https://baize.aber.sh/asgi#fileresponse)
193-
194-
As a smooth replacement for Starlette [`FileResponse`](https://www.starlette.io/responses/#fileresponse), it will automatically handle [Head method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) and [Range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).

starlette/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.38.6"
1+
__version__ = "0.39.0"

starlette/responses.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from functools import partial
1313
from mimetypes import guess_type
1414
from random import choices as random_choices
15-
from typing import Mapping
1615
from urllib.parse import quote
1716

1817
import anyio
@@ -280,7 +279,7 @@ def __init__(
280279
self,
281280
path: str | os.PathLike[str],
282281
status_code: int = 200,
283-
headers: Mapping[str, str] | None = None,
282+
headers: typing.Mapping[str, str] | None = None,
284283
media_type: str | None = None,
285284
background: BackgroundTask | None = None,
286285
filename: str | None = None,

0 commit comments

Comments
 (0)