2019-04-24 21:52:08 +00:00
|
|
|
package middlewares
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/valyala/fasthttp"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestShouldCallNextFunction(t *testing.T) {
|
|
|
|
var val = false
|
2020-05-05 19:35:32 +00:00
|
|
|
|
2019-04-24 21:52:08 +00:00
|
|
|
f := func(ctx *fasthttp.RequestCtx) { val = true }
|
|
|
|
|
|
|
|
context := &fasthttp.RequestCtx{}
|
2022-05-03 02:19:30 +00:00
|
|
|
LogRequest(f)(context)
|
2019-04-24 21:52:08 +00:00
|
|
|
|
|
|
|
assert.Equal(t, true, val)
|
|
|
|
}
|