Skip to content

Commit

Permalink
Fix #296, prep for release
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoPrevato committed Jan 1, 2023
1 parent 0cae556 commit b06a222
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions blacksheep/server/cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b06a222

Please sign in to comment.