From 9ce62c05d29db4658adc79b6b3fdf92008713caf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:58:48 +0000 Subject: [PATCH 1/2] Bump starlette from 0.37.2 to 0.38.4 Bumps [starlette](https://github.com/encode/starlette) from 0.37.2 to 0.38.4. - [Release notes](https://github.com/encode/starlette/releases) - [Changelog](https://github.com/encode/starlette/blob/master/docs/release-notes.md) - [Commits](https://github.com/encode/starlette/compare/0.37.2...0.38.4) --- updated-dependencies: - dependency-name: starlette dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 8 ++++---- pyproject.toml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index b1f08bf0..e25d2b92 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2350,13 +2350,13 @@ doc = ["sphinx"] [[package]] name = "starlette" -version = "0.37.2" +version = "0.38.4" description = "The little ASGI library that shines." optional = false python-versions = ">=3.8" files = [ - {file = "starlette-0.37.2-py3-none-any.whl", hash = "sha256:6fe59f29268538e5d0d182f2791a479a0c64638e6935d1c6989e63fb2699c6ee"}, - {file = "starlette-0.37.2.tar.gz", hash = "sha256:9af890290133b79fc3db55474ade20f6220a364a0402e0b556e7cd5e1e093823"}, + {file = "starlette-0.38.4-py3-none-any.whl", hash = "sha256:526f53a77f0e43b85f583438aee1a940fd84f8fd610353e8b0c1a77ad8a87e76"}, + {file = "starlette-0.38.4.tar.gz", hash = "sha256:53a7439060304a208fea17ed407e998f46da5e5d9b1addfea3040094512a6379"}, ] [package.dependencies] @@ -2592,4 +2592,4 @@ starlette = ["aioitertools", "starlette"] [metadata] lock-version = "2.0" python-versions = "^3.8.0" -content-hash = "9256d4197366f7ddd6c36ec950c373508dfbf7c20e6e36c4b46c3d1187416eec" +content-hash = "ab4d2745fbf177094a1711e5d45775583d72f7dbc7840e5fd5dfe945fe48f793" diff --git a/pyproject.toml b/pyproject.toml index ed78d5de..0bca938d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,7 @@ django = {version = ">=3.0", optional = true} falcon = {version = ">=3.0", optional = true} flask = {version = "*", optional = true} aiohttp = {version = ">=3.0", optional = true} -starlette = {version = ">=0.26.1,<0.38.0", optional = true} +starlette = {version = ">=0.26.1,<0.39.0", optional = true} isodate = "*" more-itertools = "*" parse = "*" @@ -101,7 +101,7 @@ pytest-flake8 = "*" pytest-cov = "*" python-multipart = "*" responses = "*" -starlette = ">=0.26.1,<0.38.0" +starlette = ">=0.26.1,<0.39.0" strict-rfc3339 = "^0.7" webob = "*" mypy = "^1.2" From eb9dbc12277abc3ce3cdce9b2931030ab061f5dc Mon Sep 17 00:00:00 2001 From: p1c2u Date: Mon, 2 Sep 2024 14:04:06 +0000 Subject: [PATCH 2/2] Starlette streaming response for HTTPMiddleware fix --- openapi_core/contrib/starlette/integrations.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openapi_core/contrib/starlette/integrations.py b/openapi_core/contrib/starlette/integrations.py index 02bfc5f1..4667fe01 100644 --- a/openapi_core/contrib/starlette/integrations.py +++ b/openapi_core/contrib/starlette/integrations.py @@ -1,7 +1,6 @@ from aioitertools.itertools import tee as atee from starlette.requests import Request from starlette.responses import Response -from starlette.responses import StreamingResponse from openapi_core.contrib.starlette.requests import StarletteOpenAPIRequest from openapi_core.contrib.starlette.responses import StarletteOpenAPIResponse @@ -24,7 +23,7 @@ async def get_openapi_response( ) -> StarletteOpenAPIResponse: assert self.response_cls is not None data = None - if isinstance(response, StreamingResponse): + if hasattr(response, "body_iterator"): body_iter1, body_iter2 = atee(response.body_iterator) response.body_iterator = body_iter2 data = b"".join(