Beispiel
Manage Guzzle sink stream persistence across intermediate redirects, error response streaming, and on_headers lifecycle aborts
sha256:1d9052aa3497cf987a30d943e2b7183d697b56cc1251f34cd5e462b4aacea0ae
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Manage Guzzle sink stream persistence across intermediate redirects, error response streaming, and on_headers lifecycle aborts HOW
- Pakete
- guzzlehttp/guzzle 8.0.2
- Umgebung
- php
- Erstellt
- 2026-08-16T12:45:15Z
Häufige Annahme
Passing a stream or resource sink to a request that follows redirects writes only the final destination response body into the sink.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- 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
Dateien
- NOTES.md
- composer.json
- composer.lock
- csx.json
- src/SinkRedirectBehavior.php
- test/contract.php
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- php 8 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · composer@1 · 2026-08-16 · ed25519:d91480838ac982c9