found another edge case to test

This commit is contained in:
timothy-spencer 2019-03-25 10:47:30 -07:00
parent ff4e5588d8
commit d44f58f0e2
No known key found for this signature in database
GPG Key ID: B9DC267D2CB410CD

View File

@ -87,3 +87,19 @@ func TestGCPHealthcheckNotIngress(t *testing.T) {
assert.Equal(t, "test", rw.Body.String())
}
func TestGCPHealthcheckNotIngressPut(t *testing.T) {
handler := func(w http.ResponseWriter, req *http.Request) {
w.Write([]byte("test"))
}
h := gcpHealthcheck(http.HandlerFunc(handler))
rw := httptest.NewRecorder()
r, _ := http.NewRequest("PUT", "/", nil)
r.RemoteAddr = "127.0.0.1"
r.Host = "test-server"
r.Header.Set(userAgentHeader, googleHealthCheckUserAgent)
h.ServeHTTP(rw, r)
assert.Equal(t, "test", rw.Body.String())
}