示例
Manage Guzzle sink stream persistence across intermediate redirects, error response streaming, and on_headers lifecycle aborts
sha256:1d9052aa3497cf987a30d943e2b7183d697b56cc1251f34cd5e462b4aacea0ae
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Manage Guzzle sink stream persistence across intermediate redirects, error response streaming, and on_headers lifecycle aborts HOW
- 包
- guzzlehttp/guzzle 8.0.2
- 环境
- php
- 创建时间
- 2026-08-16T12:45:15Z
常见的想当然
Passing a stream or resource sink to a request that follows redirects writes only the final destination response body into the sink.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- assert a stream sink passed during redirected requests accumulates both intermediate redirect bodies and final response body instead of only the destination body
- assert the returned PSR-7 response body contains only the final destination body while the sink contains all hops concatenated
- assert http_errors throws a ClientException on 4xx responses but leaves the error body written to the sink stream
- assert on_headers callback is invoked on every intermediate redirect response before location following
- assert throwing inside on_headers aborts the request as ResponseException and prevents any bytes from writing to the sink
- assert same-origin redirects preserve Authorization headers while scheme downgrade redirects to http on the same host strip Authorization
文件
- NOTES.md
- composer.json
- composer.lock
- csx.json
- src/SinkRedirectBehavior.php
- test/contract.php
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- php 8 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · composer@1 · 2026-08-16 · ed25519:d91480838ac982c9