TestProxyHandler_UnsupportedVersion verifies the handler rejects requests whose HeaderProxyVersion is absent or set to an unknown value. Kept in front so an old client paired with a newer server (or vice versa) surfaces a clear 400 instead of a misleading HMAC mismatch downstream.
(t *testing.T)
| 126 | // front so an old client paired with a newer server (or vice versa) surfaces |
| 127 | // a clear 400 instead of a misleading HMAC mismatch downstream. |
| 128 | func TestProxyHandler_UnsupportedVersion(t *testing.T) { |
| 129 | h := newTestHandler([]byte("key")) |
| 130 | for _, v := range []string{"", "v0", "v2"} { |
| 131 | req := httptest.NewRequest("GET", "/path", nil) |
| 132 | if v != "" { |
| 133 | req.Header.Set(sidecar.HeaderProxyVersion, v) |
| 134 | } |
| 135 | w := httptest.NewRecorder() |
| 136 | h.ServeHTTP(w, req) |
| 137 | if w.Code != http.StatusBadRequest { |
| 138 | t.Errorf("version=%q: expected 400, got %d", v, w.Code) |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | func TestProxyHandler_MissingTimestamp(t *testing.T) { |
| 144 | h := newTestHandler([]byte("key")) |
nothing calls this directly
no test coverage detected