2020-02-05 17:37:04 +01:00
|
|
|
package fiber
|
|
|
|
|
|
|
|
import (
|
2020-02-06 03:50:13 +01:00
|
|
|
"net/http"
|
2020-02-05 17:37:04 +01:00
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Test_Append(t *testing.T) {
|
|
|
|
app := New()
|
2020-02-06 03:50:13 +01:00
|
|
|
app.Get("/test", func(c *Ctx) {
|
|
|
|
c.Append("X-Test", "hel")
|
|
|
|
c.Append("X-Test", "lo", "world")
|
2020-02-05 17:37:04 +01:00
|
|
|
})
|
2020-02-06 03:50:13 +01:00
|
|
|
req, _ := http.NewRequest("GET", "/test", nil)
|
|
|
|
res, err := app.Test(req)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf(`%s: %s`, t.Name(), err)
|
2020-02-05 17:37:04 +01:00
|
|
|
}
|
2020-02-06 03:50:13 +01:00
|
|
|
if !strings.Contains(res, "X-Test: hel, lo, world") {
|
|
|
|
t.Fatalf(`%s: Expecting %s`, t.Name(), "X-Test: hel, lo, world")
|
2020-02-05 17:37:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: add all functions from response.go
|