diff --git a/CHANGELOG.md b/CHANGELOG.md index 768fc108..ca8ec3b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,16 @@ -## 0.10.1 (Future release) +## 0.11.0 -* Added CONTRIBUTING.md to outline contribution guidelines. +* Remove deprecated `enable_lifespan` parameter [#109](https://github.com/jordaneremieff/mangum/issues/109). -* Remove deprecated `enable_lifespan` parameter [109](https://github.com/jordaneremieff/mangum/issues/109) +* Include API Gateway v2 event cookies in scope headers [#153](https://github.com/jordaneremieff/mangum/pull/153). Thanks [araki-yzrh](https://github.com/araki-yzrh)! + +* Support ELB and fix APIGW v2 cookies response [#155](https://github.com/jordaneremieff/mangum/pull/155). Thanks [araki-yzrh](https://github.com/araki-yzrh)! + +* Add flake8 to CI checks [#157](https://github.com/jordaneremieff/mangum/pull/157). Thanks [emcpow2](https://github.com/emcpow2)! + +* Add type hints for lambda handler context parameter [#158](https://github.com/jordaneremieff/mangum/pull/158). Thanks [emcpow2](https://github.com/emcpow2)! + +* Extract ASGI scope creation into function [#162](https://github.com/jordaneremieff/mangum/pull/162). Thanks [emcpow2](https://github.com/emcpow2)! ## 0.10.0 @@ -24,14 +32,10 @@ ## 0.9.1 -* Improve documentation, include CHANGELOG in repo, and include release notes in documentation [#111](https://github.com/jordaneremieff/mangum/pull/111) - * Bugfix lifespan startup behaviour and refactor lifespan cycle, deprecate `enable_lifespan` parameter, document protocols. [#108](https://github.com/jordaneremieff/mangum/pull/108) ## 0.9.0 -* Improve documentation [#48](https://github.com/jordaneremieff/mangum/issues/48) - * Resolve issue with `rawQueryString` in HTTP APIs using wrong type [#105](https://github.com/jordaneremieff/mangum/issues/105) * Implement new WebSocket storage backends for managing connections (PostgreSQL, Redis, DyanmoDB, S3, SQlite) using a single `dsn` configuration parameter [#103](https://github.com/jordaneremieff/mangum/pull/103) diff --git a/docs/release-notes.md b/docs/release-notes.md index 768fc108..ca8ec3b5 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,8 +1,16 @@ -## 0.10.1 (Future release) +## 0.11.0 -* Added CONTRIBUTING.md to outline contribution guidelines. +* Remove deprecated `enable_lifespan` parameter [#109](https://github.com/jordaneremieff/mangum/issues/109). -* Remove deprecated `enable_lifespan` parameter [109](https://github.com/jordaneremieff/mangum/issues/109) +* Include API Gateway v2 event cookies in scope headers [#153](https://github.com/jordaneremieff/mangum/pull/153). Thanks [araki-yzrh](https://github.com/araki-yzrh)! + +* Support ELB and fix APIGW v2 cookies response [#155](https://github.com/jordaneremieff/mangum/pull/155). Thanks [araki-yzrh](https://github.com/araki-yzrh)! + +* Add flake8 to CI checks [#157](https://github.com/jordaneremieff/mangum/pull/157). Thanks [emcpow2](https://github.com/emcpow2)! + +* Add type hints for lambda handler context parameter [#158](https://github.com/jordaneremieff/mangum/pull/158). Thanks [emcpow2](https://github.com/emcpow2)! + +* Extract ASGI scope creation into function [#162](https://github.com/jordaneremieff/mangum/pull/162). Thanks [emcpow2](https://github.com/emcpow2)! ## 0.10.0 @@ -24,14 +32,10 @@ ## 0.9.1 -* Improve documentation, include CHANGELOG in repo, and include release notes in documentation [#111](https://github.com/jordaneremieff/mangum/pull/111) - * Bugfix lifespan startup behaviour and refactor lifespan cycle, deprecate `enable_lifespan` parameter, document protocols. [#108](https://github.com/jordaneremieff/mangum/pull/108) ## 0.9.0 -* Improve documentation [#48](https://github.com/jordaneremieff/mangum/issues/48) - * Resolve issue with `rawQueryString` in HTTP APIs using wrong type [#105](https://github.com/jordaneremieff/mangum/issues/105) * Implement new WebSocket storage backends for managing connections (PostgreSQL, Redis, DyanmoDB, S3, SQlite) using a single `dsn` configuration parameter [#103](https://github.com/jordaneremieff/mangum/pull/103) diff --git a/mangum/adapter.py b/mangum/adapter.py index cabfc954..0ff68a5b 100644 --- a/mangum/adapter.py +++ b/mangum/adapter.py @@ -98,14 +98,15 @@ def __call__(self, event: dict, context: "LambdaContext") -> dict: elif not isinstance(initial_body, bytes): initial_body = initial_body.encode() - scope = self._create_scope(event, context) + scope = self.create_scope(event, context) http_cycle = HTTPCycle(scope, text_mime_types=self.text_mime_types) response = http_cycle(self.app, initial_body) return response - def _create_scope(self, event: dict, context: "LambdaContext") -> Scope: - """Creates a scope object according to ASGI specification from a Lambda Event. + def create_scope(self, event: dict, context: "LambdaContext") -> Scope: + """ + Creates a scope object according to ASGI specification from a Lambda Event. https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope diff --git a/mangum/protocols/http.py b/mangum/protocols/http.py index ea47eefc..1cb5d413 100644 --- a/mangum/protocols/http.py +++ b/mangum/protocols/http.py @@ -174,7 +174,7 @@ async def send(self, message: Message) -> None: self.response["headers"] = headers if multi_value_headers: self.response["multiValueHeaders"] = multi_value_headers - if len(cookies): + if cookies: self.response["cookies"] = cookies self.state = HTTPCycleState.RESPONSE diff --git a/setup.py b/setup.py index 1f9c9647..2a780ce7 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def get_long_description(): setup( name="mangum", - version="0.10.0", + version="0.11.0", packages=find_packages(), license="MIT", url="https://github.com/jordaneremieff/mangum",