Skip to content

feat: per-request transport options - #1

Merged
zlodes merged 2 commits into
mainfrom
feat/transport-options
Sep 26, 2026
Merged

zlodes merged 2 commits into
mainfrom
feat/transport-options

Conversation

@zlodes

@zlodes zlodes commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Transport::send() now takes a TransportOptions argument, so timeouts set by middleware or by a request reach the transport instead of being dropped at the PSR-7 boundary.
  • Timeouts are set with WithTimeout (factory), TimeoutMiddleware (pipeline), or HasTransportOptions (per endpoint). Precedence is request > client > global default; null never overwrites a value set earlier.
  • Adds GuzzleTransport, which maps the options and throws TransportTimeoutException on a cURL timeout. Psr18Transport ignores them, since PSR-18 has no per-request options.

Breaking change: every custom Transport and test double must accept the second argument. See UPGRADE-1.0.md. The BREAKING CHANGE commit footer makes semantic-release cut 1.0.0 on merge.

guzzlehttp/guzzle moves from a README suggestion to a hard dependency. A PHPStan stub cannot describe an optional class, so declaring it optional would break analysis for consumers without Guzzle installed.

Test Plan

  • vendor/bin/phpunit — 63 tests, 133 assertions, 0 failures
  • vendor/bin/phpstan analyse — no errors at max level
  • vendor/bin/phpcs -p src — clean
  • composer normalize --dry-run — already normalized
  • CI green on this PR

Transport::send() now takes a TransportOptions argument, so timeouts set
by middleware or by a request reach the transport instead of being dropped
at the PSR-7 boundary.

BREAKING CHANGE: Transport::send() requires a second TransportOptions
argument. Custom transports and test doubles must accept it. See
UPGRADE-1.0.md.
Extract the request-level options step into its own middleware so
HttpClient no longer imports a class from its own namespace.
@zlodes
zlodes merged commit 00effa5 into main Sep 26, 2026
10 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant