diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6ddd062c..df8b53ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -241,15 +241,26 @@ jobs: with: name: dist path: dist - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@master + + - name: Use Python 3.11 + uses: actions/setup-python@v1 with: - skip_existing: true - user: __token__ - password: ${{ secrets.test_pypi_password }} - repository_url: https://test.pypi.org/legacy/ + python-version: '3.11' + + - name: Install dependencies + run: | + pip install twine + + - name: Publish distribution 📦 to Test PyPI + run: | + twine upload -r testpypi dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.test_pypi_password }} + - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_password }} + run: | + twine upload -r pypi dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.pypi_password }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c5a400..bba81b15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.9] - 2023-01-01 :fireworks: +- Fix invalid OpenAPI doc for route parameter with pattern (#286) - [antipooh](https://github.com/antipooh)'s contribution. +- Fix a bug related to nullable boolean values https://github.com/Neoteroi/BlackSheep/commit/363616b7fa4cb69bf698c25768e9de04e36feb69 [jack-fireworkhq](https://github.com/jack-fireworkhq)'s contribution. +- Fix a bug preventing web sockets from working when CORS is enabled (#296) - reported by [netwang on gitter](https://gitter.im/Neoteroi/BlackSheep). + ## [1.2.8] - 2022-10-27 :snake: - Upgrades pinned dependencies to support Python 3.11 - Drops active support for Python 3.7 (it is not tested anymore in CI pipelines) diff --git a/blacksheep/server/cors.py b/blacksheep/server/cors.py index 43ea76af..f1c4fc80 100644 --- a/blacksheep/server/cors.py +++ b/blacksheep/server/cors.py @@ -5,6 +5,7 @@ from blacksheep.baseapp import BaseApplication from blacksheep.messages import Request, Response from blacksheep.server.routing import Route, Router +from blacksheep.server.websocket import WebSocket from .responses import not_found, ok, status_code @@ -243,6 +244,9 @@ def get_cors_middleware( strategy: CORSStrategy, ) -> Callable[[Request, Callable[..., Any]], Awaitable[Response]]: async def cors_middleware(request: Request, handler): + if isinstance(request, WebSocket): + return await handler(request) + origin = request.get_first_header(b"Origin") if not origin: