@@ -5,6 +5,62 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 2.1.0] - 2025-03-23
9+
10+ - Remove support for Python 3.8, by @bymoye .
11+ - Fix a bug in the ` ClientSession ` , happening when the server returns a response
12+ body without specifying ` Content-Length ` and without specifying a
13+ ` Transfer-Encoding ` .
14+ - Fix a bug in the ` ClientSession ` , happening when a server closes the
15+ connection, and the response content is not set as completed.
16+ - Add a default ` User-Agent ` to web requests sent using the ` ClientSession ` ,
17+ the user agent is: ` python-blacksheep/{__version__} ` .
18+ - Add an async method ` raise_for_status ` to the ` Response ` object, which raises
19+ an exception of type ` FailedRequestError ` if the response status is not in
20+ the range ** 200-299** . The method is asynchronous because in case of failure
21+ it waits for the response body to be downloaded, to include it in the raised
22+ exception.
23+ - Add support for specifying a prefix for the ` Router ` , and for configuring a
24+ global prefix for all routes using the env variable ` APP_ROUTE_PREFIX ` .
25+ If specified, the prefix is applied to all routes registered in the
26+ application router. The prefix is used automatically by the
27+ ` serve_files ` method, the ` get_absolute_url_to_path ` method, and by the
28+ OpenAPI UI feature, to serve documentation to the correct path.
29+ This feature is useful when exposing applications behind proxies using
30+ path based routing, to maintain the same path between the proxy server and
31+ the BlackSheep application. This is an alternative approach to the one used
32+ by the ` root_path ` offered by ` ASGI ` (still supported in ` BlackSheep ` ).
33+ ASGI ` root_path ` and route prefix in BlackSheep are alternative ways to
34+ address the same issue, and should not be used together.
35+ - Improve the OpenAPI UI to support router prefixes, and fetching the
36+ specification file using relative links.
37+ - Upgrade to ` Cython ` to ` 3.0.12 ` in the GitHub Workflow.
38+ - Handle setuptools warning: _ SetuptoolsDeprecationWarning: License classifiers are deprecated_ .
39+ - Improve ` pyproject.toml ` to use ` tool.setuptools.packages.find ` .
40+ - Add the missing "utf8" encoding to the ` request.path ` property decode call.
41+ - Add a middleware to handle automatic redirects from URLs that do not end with
42+ a "/" towards the same path with a trailing slash. This is useful for
43+ endpoints that serve HTML documents, to ensure that relative URLs in the
44+ response body are correctly resolved
45+ (` from blacksheep.server.redirects import get_trailing_slash_middleware ` ).
46+ - Add a built-in strategy to handle startup errors and display an error page
47+ when an application fails during initialization, in
48+ ` blacksheep.server.diagnostics.get_diagnostic_app ` . Error details are not
49+ displayed by default, but can be displayed setting the environment variable
50+ ` APP_SHOW_ERROR_DETAILS ` to a value such as ` 1 ` or ` true ` .
51+ - Use ` asyncio_mode=auto ` for ` pytest ` (remove ` @pytest.mark.asyncio ` decorators).
52+ - Use ` Python 3.12 ` to publish the package, in the GitHub Workflow.
53+ - Modify the ` Application ` object to instantiate requests in a dedicated method
54+ ` instantiate_request ` . This is to better support code that modifies how
55+ incoming requests are created.
56+ - Modify the ` OpenAPIHandler ` class to support specifying the list of ` Server `
57+ objects in the constructor.
58+ - Update ` essentials-openapi ` pinned version, by @stollero .
59+ - Bump jinja2 from 3.1.4 to 3.1.6.
60+ - Bump cryptography from 44.0.0 to 44.0.1.
61+ - Remove ` py ` from the list of dependencies in ` requirements.txt ` .
62+ - Correct some docstrings.
63+
864## [ 2.0.8] - 2025-01-25
965
1066- Add Python 3.13 to the build matrix and several maintenance fixes, by @waketzheng .
0 commit comments