Commit 162424b9 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Always remove the senddata header

parent ab7a52c5
......@@ -48,6 +48,7 @@ func (s *sendDataResponseWriter) WriteHeader(status int) {
return
}
s.Header().Del(HeaderKey)
s.rw.WriteHeader(s.status)
}
......
package senddata
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestHeaderDelete(t *testing.T) {
for _, code := range []int{200, 400} {
recorder := httptest.NewRecorder()
rw := &sendDataResponseWriter{rw: recorder, req: &http.Request{}}
rw.Header().Set(HeaderKey, "foobar")
rw.WriteHeader(code)
if header := recorder.Header().Get(HeaderKey); header != "" {
t.Fatalf("HTTP %d response: expected header to be empty, found %q", code, header)
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment