Ejemplo
Configure Rack::Test session host defaults, secure cookie URI requirements, multi-session isolation, restore_state header leaks, and symbol XHR flags
sha256:8a39d61a043d3d3266b938f3aee80a49ca9a57038e54bbe3d199bef1a92695bd
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Configure Rack::Test session host defaults, secure cookie URI requirements, multi-session isolation, restore_state header leaks, and symbol XHR flags HOW
- Paquetes
- rack-test 2.2.0 rack 3.2.7
- Entorno
- ruby
- Creado
- 2026-08-17T02:45:45Z
Lo que suele suponerse
Calling set_cookie with a secure attribute on a session stores the cookie in the jar for HTTPS requests and accepts a URI string.
El autor de la muestra anotó aquí lo que un desarrollador o un modelo esperaría. El contrato de abajo es lo que realmente se ejecutó.
Contrato
- assert calling set_cookie with a secure attribute without an explicit URI object silently drops the cookie because default URI lacks an HTTPS scheme, while passing a URI string raises NoMethodError
- assert defining default_host on the test harness sets HTTP_HOST on relative requests and isolates host-only cookies from requests targeting other hosts
- assert with_session isolates cookie jars, session headers, and request history across distinct named clients
- assert restore_state rolls back last_request, last_response, and cookie_jar but leaves session env headers mutated
- assert passing xhr: true requires a Symbol key in request env to set HTTP_X_REQUESTED_WITH while string keys are ignored
- assert after_request registers callbacks that execute in order after response parsing with access to last_response
Archivos
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/app.rb
- test/contract.rb
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-17 · ed25519:d91480838ac982c9