test: harden version endpoint boundaries
This commit is contained in:
@@ -26,7 +26,7 @@ func TestVersionIsPublicAndBounded(t *testing.T) {
|
||||
server := New("127.0.0.1:0", nil)
|
||||
rr := httptest.NewRecorder()
|
||||
server.Handler.ServeHTTP(rr, httptest.NewRequest(http.MethodGet, "/version", nil))
|
||||
if rr.Code != http.StatusOK || !strings.Contains(rr.Body.String(), `"http_protocol_version":"1"`) || strings.Contains(rr.Body.String(), "ORBIT_MYSQL_DSN") {
|
||||
if rr.Code != http.StatusOK || rr.Header().Get("Cache-Control") != "no-store" || rr.Header().Get("X-Content-Type-Options") != "nosniff" || rr.Header().Get("Content-Type") != "application/json" || !strings.Contains(rr.Body.String(), `"http_protocol_version":"1"`) || strings.Contains(rr.Body.String(), "ORBIT_MYSQL_DSN") {
|
||||
t.Fatalf("unexpected version response: %d %s", rr.Code, rr.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user