mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 12:12:12 +08:00
fix: fix typo for c.ShouldBindBodyWithPlain comment and fix context_test for golang-lint
This commit is contained in:
parent
f05f966a08
commit
4b973201ae
@ -951,7 +951,7 @@ func (c *Context) ShouldBindBodyWithTOML(obj any) error {
|
||||
return c.ShouldBindBodyWith(obj, binding.TOML)
|
||||
}
|
||||
|
||||
// ShouldBindBodyWithJSON is a shortcut for c.ShouldBindBodyWith(obj, binding.JSON).
|
||||
// ShouldBindBodyWithPlain is a shortcut for c.ShouldBindBodyWith(obj, binding.Plain).
|
||||
func (c *Context) ShouldBindBodyWithPlain(obj any) error {
|
||||
return c.ShouldBindBodyWith(obj, binding.Plain)
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ func TestContextGetFloat32(t *testing.T) {
|
||||
key := "float32"
|
||||
value := float32(3.14)
|
||||
c.Set(key, value)
|
||||
assert.Equal(t, value, c.GetFloat32(key))
|
||||
assert.InDelta(t, value, c.GetFloat32(key), 0.01)
|
||||
}
|
||||
|
||||
func TestContextGetFloat64(t *testing.T) {
|
||||
@ -2857,7 +2857,8 @@ func TestContextWithFallbackValueFromRequestContext(t *testing.T) {
|
||||
{
|
||||
name: "c with struct context key",
|
||||
getContextAndKey: func() (*Context, any) {
|
||||
var key struct{}
|
||||
type KeyStruct struct{} // https://staticcheck.dev/docs/checks/#SA1029
|
||||
var key KeyStruct
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
// enable ContextWithFallback feature flag
|
||||
c.engine.ContextWithFallback = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user