test: check request errors and stop asserting PathRewrite on /v1/models

/v1/models is served from config by ServeHTTP (task 2.5) so it never reaches
routing; the rewrite test now uses a non-reserved path.
This commit is contained in:
Story Crater Bot
2026-08-19 23:55:42 -07:00
parent c8c656046a
commit 8feee6754b
9 changed files with 183 additions and 67 deletions
+8 -3
View File
@@ -105,7 +105,9 @@ func TestProxyPathRewrite(t *testing.T) {
server := httptest.NewServer(handler)
defer server.Close()
resp, err := http.Get(server.URL + "/v1/models")
// Not /v1/models: ServeHTTP serves that endpoint from config (task 2.5)
// and returns before routing, so it never exercises PathRewrite.
resp, err := http.Get(server.URL + "/some/path")
if err != nil {
t.Fatalf("request failed: %v", err)
}
@@ -146,7 +148,7 @@ func TestProxyConnectionReuse(t *testing.T) {
defer handler.Close()
// Verify connection reuse by checking that the same transport is used
// We can't easily count raw TCP connections in this test setup,
// but we can verify that the transport is being reused by checking
// that the same transport handles both requests
@@ -402,7 +404,10 @@ func TestProxyPreservesBody(t *testing.T) {
defer server.Close()
testBody := `{"model": "test", "messages": []}`
resp, _ := http.Post(server.URL+"/test", "application/json", strings.NewReader(testBody))
resp, err := http.Post(server.URL+"/test", "application/json", strings.NewReader(testBody))
if err != nil {
t.Fatalf("request failed: %v", err)
}
resp.Body.Close()
if receivedBody != testBody {