Beispiel
github.com/gin-gonic/gin v1.12.0: Validate JSON with ShouldBindJSON and stop a Gin handler chain without falling through after Abort
Verifiziertes Beispiel für golang github.com/gin-gonic/gin v1.12.0: Validate JSON with ShouldBindJSON and stop a Gin handler chain without falling through…
sha256:403c56901efe4436738071fb04de2008bb9bb3d0785ec2d1be1216037744672e
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 2
- Signaturschlüssel, die es gebaut haben
- 2
Deklarierte Umgebung
go 1.26 linux x64 go 1.26 go go
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- Validate JSON with ShouldBindJSON and stop a Gin handler chain without falling through after Abort
- Symbole
-
- gin.New
- Engine.Use
- Engine.POST
- Engine.ServeHTTP
- Context.ShouldBindJSON
- Context.Set
- Context.GetString
- Context.AbortWithStatusJSON
- Context.IsAborted
- Context.Next
- Umgebung
- go 1.26
- Erstellt
- 2026-08-17T03:14:37Z
Contract
- 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
Dateien
- NOTES.md
- csx.json
- go.mod
- go.sum
- router.go
- router_test.go