integration: Add tests for 204 status code

This commit is contained in:
Tatsuhiro Tsujikawa 2017-04-07 21:46:33 +09:00
parent 46ccc4332c
commit 28082ff5f5
1 changed files with 40 additions and 0 deletions

View File

@ -1548,6 +1548,26 @@ func TestH2H1HTTPSRedirectPort(t *testing.T) {
} }
} }
// TestH2H1Code204 tests that 204 response without content-length, and
// transfer-encoding is valid.
func TestH2H1Code204(t *testing.T) {
st := newServerTester(nil, t, func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNoContent)
})
defer st.Close()
res, err := st.http2(requestParam{
name: "TestH2H1Code204",
})
if err != nil {
t.Fatalf("Error st.http2() = %v", err)
}
if got, want := res.status, 204; got != want {
t.Errorf("status = %v; want %v", got, want)
}
}
// TestH2H1GracefulShutdown tests graceful shutdown. // TestH2H1GracefulShutdown tests graceful shutdown.
func TestH2H1GracefulShutdown(t *testing.T) { func TestH2H1GracefulShutdown(t *testing.T) {
st := newServerTester(nil, t, noopHandler) st := newServerTester(nil, t, noopHandler)
@ -2159,6 +2179,26 @@ func TestH2H2DNS(t *testing.T) {
} }
} }
// TestH2H2Code204 tests that 204 response without content-length, and
// transfer-encoding is valid.
func TestH2H2Code204(t *testing.T) {
st := newServerTester([]string{"--http2-bridge"}, t, func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNoContent)
})
defer st.Close()
res, err := st.http2(requestParam{
name: "TestH2H2Code204",
})
if err != nil {
t.Fatalf("Error st.http2() = %v", err)
}
if got, want := res.status, 204; got != want {
t.Errorf("status = %v; want %v", got, want)
}
}
// TestH2APIBackendconfig exercise backendconfig API endpoint routine // TestH2APIBackendconfig exercise backendconfig API endpoint routine
// for successful case. // for successful case.
func TestH2APIBackendconfig(t *testing.T) { func TestH2APIBackendconfig(t *testing.T) {