CodeSampleX

サンプル

sinatra 4.2.1: Demonstrate how Sinatra's route pass mechanism preserves response status codes, headers, cookies, and params mutations across route conditions and fallback handlers

検証済みサンプル — gem sinatra 4.2.1: Demonstrate how Sinatra's route pass mechanism preserves response status codes, headers, cookies, and params mutations across…

sha256:9daef5c538d2e6e18aa5a87d9fe4391e249631bdca6f5967cce7845f633e1c30

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 ruby linux x64 ruby ruby bundle

検証実行環境

環境 コントラクト ステージ 実行日
ruby 3 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-16
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-18

ケース

HOW
ゴール
Demonstrate how Sinatra's route pass mechanism preserves response status codes, headers, cookies, and params mutations across route conditions and fallback handlers
パッケージ
シンボル
  • Sinatra::Base#pass
  • Sinatra::Base#condition
  • Sinatra::Base#status
  • Sinatra::Base#headers
  • Sinatra::Response#set_cookie
  • Sinatra::Base#params
環境
ruby
作成日
2026-08-16T17:02:11Z

コントラクト

  1. Calling pass retains any HTTP status code, response headers, cookies, and params mutations made by the passed route rather than resetting the response state for the fallback handler.
  2. assert a fallback route returning a string inherits the non-200 HTTP status code set before pass when the fallback does not explicitly assign status
  3. assert response headers and cookies set by a passed route are preserved in the final HTTP response
  4. assert route conditions are evaluated in sequence on the shared request instance and accumulate headers across evaluations
  5. assert route parameters mutated before pass remain accessible in subsequent matching route handlers
  6. assert calling pass when no downstream route matches yields a 404 response with X-Cascade: pass while still preserving headers and cookies set before pass

ファイル

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • src/app.rb
  • test/contract.rb

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed