Skip to content

[codex] run middleware before response resolution - #35

Merged
k-kinzal merged 2 commits into
mainfrom
codex/run-middleware-before-response-resolution
Jul 4, 2026
Merged

[codex] run middleware before response resolution#35
k-kinzal merged 2 commits into
mainfrom
codex/run-middleware-before-response-resolution

Conversation

@k-kinzal

@k-kinzal k-kinzal commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Moves PSR-15 middleware so it wraps the response resolution handler instead of only receiving an already-resolved response.

Root Cause

Interceptor::handle() resolved the OpenAPI operation and generated or selected the response before invoking middleware. A middleware could add headers to the response, but request changes made before $handler->handle() could not affect operation lookup, handlers, or faker generation.

Changes

  • Extend MiddlewarePipeline with handle($request, RequestHandlerInterface $handler).
  • Keep the existing process($request, $response) API by adapting it to a resolved-response handler.
  • Run Interceptor response resolution through the middleware chain.
  • Add regression coverage for request rewriting before operation resolution.

Validation

  • composer test
  • composer lint

@k-kinzal
k-kinzal marked this pull request as ready for review July 4, 2026 16:09
…before-response-resolution

# Conflicts:
#	src/Interceptor.php
@k-kinzal
k-kinzal merged commit 09637aa into main Jul 4, 2026
57 checks passed
@k-kinzal
k-kinzal deleted the codex/run-middleware-before-response-resolution branch July 4, 2026 16:18
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