Skip to content

Add expect handler and simplify apps#13

Open
mosquito wants to merge 7 commits intomasterfrom
expect-handler
Open

Add expect handler and simplify apps#13
mosquito wants to merge 7 commits intomasterfrom
expect-handler

Conversation

@mosquito
Copy link
Owner

@meyerj what do you think if the current app is ContextVar now?

@mosquito mosquito requested a review from Copilot June 10, 2025 12:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an HTTP Expect: 100-continue handler to the ASGI app and refactors the internal apps stack management in ASGIMatchInfo.

  • Introduces a new POST /upload endpoint that returns the parsed Expect header and body size.
  • Adds a basic integration test for the Expect handler.
  • Refactors ASGIMatchInfo to use a ContextVar for the current app and defines a ResourceInfoDict TypedDict.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tests/test_fastapi_integration.py Added imports, /upload endpoint, and test_expect_handler_basic
aiohttp_asgi/resource.py Refactored ASGIMatchInfo to use ContextVar; added ResourceInfoDict
Comments suppressed due to low confidence (1)

tests/test_fastapi_integration.py:179

  • The response includes received_expect but the test does not assert its value. Add an assertion like assert data["received_expect"] == "100-continue" to ensure the header is handled correctly.
assert data["body_size"] == len(test_data)

mosquito and others added 4 commits June 10, 2025 14:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants