mirror of https://github.com/gofiber/fiber.git
fix up some linting issues
parent
fea24d46f7
commit
9733eabf63
8
ctx.go
8
ctx.go
|
@ -450,8 +450,8 @@ func (c *DefaultCtx) Cookie(cookie *Cookie) {
|
||||||
//
|
//
|
||||||
// Due to current limitations in how fasthttp works, Deadline operates as a nop.
|
// Due to current limitations in how fasthttp works, Deadline operates as a nop.
|
||||||
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
|
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
|
||||||
func (c *DefaultCtx) Deadline() (deadline time.Time, ok bool) {
|
func (*DefaultCtx) Deadline() (deadline time.Time, ok bool) {
|
||||||
return
|
return time.Time{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done returns a channel that's closed when work done on behalf of this
|
// Done returns a channel that's closed when work done on behalf of this
|
||||||
|
@ -462,7 +462,7 @@ func (c *DefaultCtx) Deadline() (deadline time.Time, ok bool) {
|
||||||
//
|
//
|
||||||
// Due to current limitations in how fasthttp works, Done operates as a nop.
|
// Due to current limitations in how fasthttp works, Done operates as a nop.
|
||||||
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
|
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
|
||||||
func (c *DefaultCtx) Done() <-chan struct{} {
|
func (*DefaultCtx) Done() <-chan struct{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ func (c *DefaultCtx) Download(file string, filename ...string) error {
|
||||||
//
|
//
|
||||||
// Due to current limitations in how fasthttp works, Err operates as a nop.
|
// Due to current limitations in how fasthttp works, Err operates as a nop.
|
||||||
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
|
// See: https://github.com/valyala/fasthttp/issues/965#issuecomment-777268945
|
||||||
func (c *DefaultCtx) Err() error {
|
func (*DefaultCtx) Err() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
17
ctx_test.go
17
ctx_test.go
|
@ -2187,6 +2187,23 @@ func Test_Ctx_Locals(t *testing.T) {
|
||||||
require.Equal(t, StatusOK, resp.StatusCode, "Status code")
|
require.Equal(t, StatusOK, resp.StatusCode, "Status code")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// go test -run Test_Ctx_Value
|
||||||
|
func Test_Ctx_Value(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
app := New()
|
||||||
|
app.Use(func(c Ctx) error {
|
||||||
|
c.Locals("john", "doe")
|
||||||
|
return c.Next()
|
||||||
|
})
|
||||||
|
app.Get("/test", func(c Ctx) error {
|
||||||
|
require.Equal(t, "doe", c.Value("john"))
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
resp, err := app.Test(httptest.NewRequest(MethodGet, "/test", nil))
|
||||||
|
require.NoError(t, err, "app.Test(req)")
|
||||||
|
require.Equal(t, StatusOK, resp.StatusCode, "Status code")
|
||||||
|
}
|
||||||
|
|
||||||
// go test -run Test_Ctx_Locals_Generic
|
// go test -run Test_Ctx_Locals_Generic
|
||||||
func Test_Ctx_Locals_Generic(t *testing.T) {
|
func Test_Ctx_Locals_Generic(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
Loading…
Reference in New Issue