mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix: strip route prefix when passing request to aibridged handler (#25671)
We weren't stripping the API base (`/api/v2/aibridge`), leading to 404s when using the in-memory transport. Signed-off-by: Danny Kopping <danny@coder.com>
This commit is contained in:
+2
-2
@@ -42,9 +42,9 @@ func (api *API) RegisterInMemoryAIBridgedHTTPHandler(srv http.Handler) {
|
||||
panic("aibridged cannot be nil")
|
||||
}
|
||||
|
||||
api.aibridgedHandler = srv
|
||||
api.aibridgedHandler = http.StripPrefix("/api/v2/aibridge", srv)
|
||||
|
||||
factory := aibridged.NewTransportFactory(srv)
|
||||
factory := aibridged.NewTransportFactory(api.aibridgedHandler)
|
||||
var asInterface agplaibridge.TransportFactory = factory
|
||||
api.AIBridgeTransportFactory.Store(&asInterface)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func aibridgeHandler(api *API, middlewares ...func(http.Handler) http.Handler) f
|
||||
return
|
||||
}
|
||||
|
||||
http.StripPrefix("/api/v2/aibridge", api.AGPL.GetAIBridgedHandler()).ServeHTTP(rw, r)
|
||||
api.AGPL.GetAIBridgedHandler().ServeHTTP(rw, r)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user