Skip to content

v2.0.4

Compare
Choose a tag to compare
@RobertoPrevato RobertoPrevato released this 31 Dec 12:32
· 18 commits to main since this release
b283414
  • Adds a is_disconnected() method to the Request class, similar to the one available in Starlette, which answers if the ASGI server published an http.disconnected message for a request. Feature requested by @netanel-haber in #452.
  • Makes the receive callable of the ASGI request accessible to Python code, through the existing ASGIContent class. The receive property was already included in contents.pyi file and it was wrong to keep receive private for Cython code.
  • Removes consts.pxi because it used a deprecated Cython feature.
  • Upgrades the versions of Hypercorn and uvicorn for integration tests.
  • Removes the unused "active" property defined in the Response class.
  • Fixes #455, reported by @Klavionik. This error caused the WebSocket handler to erroneously return an instance of BlackSheep response to the underlying ASGI server, causing an error to be logged in the console.
  • Updates type annotations in the Application class code to be more explicit about the fact that certain methods must return None (return in call is used to interrupt code execution and not to return objects).
  • Improves the normalization logic to not normalize the output for WebSocket requests (as ASGI servers do not allow controlling the response for WebSocket handshake requests).
  • Improves the normalization logic to not normalize request handlers that are valid as they are, as asynchronous functions with a single parameter annotated as Request or WebSocket.
  • Fixes #421 reported by @mohd-akram, causing handled exceptions to be logged like unhandled, when defining exception handlers using subclasses.
  • Removes wrong type annotations in two functions in blacksheep.utils.