summaryrefslogtreecommitdiff
path: root/service/http/response_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'service/http/response_test.go')
-rw-r--r--service/http/response_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/service/http/response_test.go b/service/http/response_test.go
index 7ba9d8d4..ad524567 100644
--- a/service/http/response_test.go
+++ b/service/http/response_test.go
@@ -132,3 +132,20 @@ func TestWrite_HandlesTrailers(t *testing.T) {
assert.Equal(t, "test", w.h.Get("Trailer:foo"))
assert.Equal(t, "demo", w.h.Get("Trailer:bar"))
}
+
+func TestWrite_HandlesHandlesWhitespacesInTrailer(t *testing.T) {
+ r, err := NewResponse(&roadrunner.Payload{
+ Context: []byte(
+ `{"headers":{"trailer":["foo\t,bar , baz"],"foo":["a"],"bar":["b"],"baz":["c"]},"status": 200}`),
+ })
+
+ assert.NoError(t, err)
+ assert.NotNil(t, r)
+
+ w := &testWriter{h: http.Header(make(map[string][]string))}
+ assert.NoError(t, r.Write(w))
+
+ assert.Equal(t, "a", w.h.Get("Trailer:foo"))
+ assert.Equal(t, "b", w.h.Get("Trailer:bar"))
+ assert.Equal(t, "c", w.h.Get("Trailer:baz"))
+}