Skip to content

perf(cors): skip Python CORS merge when Origin is absent - #133

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue-108-cors-skip-origin
Jul 20, 2026
Merged

perf(cors): skip Python CORS merge when Origin is absent#133
ZhuchkaTriplesix merged 1 commit into
devfrom
issue-108-cors-skip-origin

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

  • Native CORS response merge skips response_header_pairs when the request has no Origin header
  • Behaviour unchanged when Origin is present (wildcard + credentialed covered by tests)
  • Counting subclass asserts zero Python calls without Origin

Closes #108

Test plan

  • pytest tests/test_cors.py tests/test_cors_units.py
  • cargo clippy --all-targets -- -D warnings
  • Manual: CORS-enabled app, request without Origin has no ACAO; with Origin still merges

Check for Origin in Rust before calling response_header_pairs so
same-origin / API-only traffic avoids a Python roundtrip. Closes #108.
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 7a92b90 into dev Jul 20, 2026
16 checks passed
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.

1 participant