サンプル
github.com/gin-gonic/gin v1.12.0: Validate JSON with ShouldBindJSON and stop a Gin handler chain without falling through after Abort
検証済みサンプル — golang github.com/gin-gonic/gin v1.12.0: Validate JSON with ShouldBindJSON and stop a Gin handler chain without falling through after Abort. go…
sha256:403c56901efe4436738071fb04de2008bb9bb3d0785ec2d1be1216037744672e
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 2
宣言された環境
go 1.26 linux x64 go 1.26 go go
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-17 |
| go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-18 |
ケース
HOW- ゴール
- Validate JSON with ShouldBindJSON and stop a Gin handler chain without falling through after Abort
- シンボル
-
- gin.New
- Engine.Use
- Engine.POST
- Engine.ServeHTTP
- Context.ShouldBindJSON
- Context.Set
- Context.GetString
- Context.AbortWithStatusJSON
- Context.IsAborted
- Context.Next
- 環境
- go 1.26
- 作成日
- 2026-08-17T03:14:37Z
コントラクト
- assert binding an empty required name with ShouldBindJSON lets the handler choose HTTP 422 and a JSON error response
- assert AbortWithStatusJSON marks the context aborted and skips the next route handler but code after AbortWithStatusJSON in the current handler still executes
- assert an explicit return after AbortWithStatusJSON prevents current-handler fallthrough as well as downstream-handler execution
- assert middleware context values and a validated JSON name flow to the next handler on a valid request
- assert all requests run through httptest and Engine.ServeHTTP without opening a network listener
ファイル
- NOTES.md
- csx.json
- go.mod
- go.sum
- router.go
- router_test.go