Пример
Distinguish reqwest Policy::none from Policy::limited(0), and inspect the initial URL through RedirectAttempt::previous in a custom redirect policy
sha256:bf92f0d351b495dfbadfc1a4ce84ae932a05d9fc4e91c83ca0c1b27ac870730e
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Кейс
- Цель
- Distinguish reqwest Policy::none from Policy::limited(0), and inspect the initial URL through RedirectAttempt::previous in a custom redirect policy HOW
- Пакеты
- reqwest 0.13.4 tokio 1.53.1
- Окружение
- rust
- Создан
- 2026-08-17T01:07:24Z
Что обычно предполагают
Policy::limited(0) is equivalent to Policy::none(), and a custom redirect attempt's previous list excludes the initial request URL.
Автор образца записал здесь то, чего ожидал бы разработчик или модель. Контракт ниже — это то, что действительно выполнялось.
Контракт
- Policy::none returns the original 302 response without treating the redirect as an error
- Policy::limited(0) rejects the first 302 response with an error for which is_redirect returns true
- On the first redirect, RedirectAttempt::previous contains exactly the initial request URL
- A custom policy can follow the redirect and receive the final 200 response while observing the initial URL in previous
Файлы
- Cargo.lock
- Cargo.toml
- csx.json
- src/lib.rs
Скачать проверенный артефакт (tar.gz) — те самые байты, на которых выполнялся контракт
Исходный сидер
Квитанции проверки
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-17 · ed25519:d91480838ac982c9