Skip to content

Commit

Permalink
Version 0.39.0 (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Sep 23, 2024
1 parent 69ed26a commit 65bfd74
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
7 changes: 7 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ hide: navigation
toc_depth: 2
---

## 0.39.0 (September 23, 2024)

#### Added

* Add support for [HTTP Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) to
`FileResponse` [#2697](https://github.com/encode/starlette/pull/2697).

## 0.38.6 (September 22, 2024)

#### Fixed
Expand Down
12 changes: 8 additions & 4 deletions docs/responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,16 @@ async def app(scope, receive, send):
await response(scope, receive, send)
```

File responses also supports [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests).

The `Accept-Ranges: bytes` header will be included in the response if the file exists. For now, only the `bytes`
range unit is supported.

If the request includes a `Range` header, and the file exists, the response will be a `206 Partial Content` response
with the requested range of bytes. If the range is invalid, the response will be a `416 Range Not Satisfiable` response.

## Third party responses

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

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.

#### [baize.asgi.FileResponse](https://baize.aber.sh/asgi#fileresponse)

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).
2 changes: 1 addition & 1 deletion starlette/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.38.6"
__version__ = "0.39.0"
3 changes: 1 addition & 2 deletions starlette/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from functools import partial
from mimetypes import guess_type
from random import choices as random_choices
from typing import Mapping
from urllib.parse import quote

import anyio
Expand Down Expand Up @@ -280,7 +279,7 @@ def __init__(
self,
path: str | os.PathLike[str],
status_code: int = 200,
headers: Mapping[str, str] | None = None,
headers: typing.Mapping[str, str] | None = None,
media_type: str | None = None,
background: BackgroundTask | None = None,
filename: str | None = None,
Expand Down

0 comments on commit 65bfd74

Please sign in to comment.