go test -run Test_Bind_RespHeader_Map -v
(t *testing.T)
| 1016 | |
| 1017 | // go test -run Test_Bind_RespHeader_Map -v |
| 1018 | func Test_Bind_RespHeader_Map(t *testing.T) { |
| 1019 | t.Parallel() |
| 1020 | |
| 1021 | app := New() |
| 1022 | c := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 1023 | |
| 1024 | c.Request().SetBody([]byte(``)) |
| 1025 | c.Request().Header.SetContentType("") |
| 1026 | |
| 1027 | c.Response().Header.Add("id", "1") |
| 1028 | c.Response().Header.Add("Name", "John Doe") |
| 1029 | c.Response().Header.Add("Hobby", "golang,fiber") |
| 1030 | q := make(map[string][]string, 0) |
| 1031 | require.NoError(t, c.Bind().RespHeader(&q)) |
| 1032 | require.Len(t, q["Hobby"], 1) |
| 1033 | |
| 1034 | c.Response().Header.Del("hobby") |
| 1035 | c.Response().Header.Add("Hobby", "golang,fiber,go") |
| 1036 | q = make(map[string][]string, 0) |
| 1037 | require.NoError(t, c.Bind().RespHeader(&q)) |
| 1038 | require.Len(t, q["Hobby"], 1) |
| 1039 | |
| 1040 | empty := make(map[string][]string, 0) |
| 1041 | c.Response().Header.Del("hobby") |
| 1042 | require.NoError(t, c.Bind().Query(&empty)) |
| 1043 | require.Empty(t, empty["Hobby"]) |
| 1044 | } |
| 1045 | |
| 1046 | // go test -v -run=^$ -bench=Benchmark_Bind_Query -benchmem -count=4 |
| 1047 | func Benchmark_Bind_Query(b *testing.B) { |
nothing calls this directly
no test coverage detected