mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-14 06:20:27 +00:00
feat: return a not found response if requested a wrong API endpoints
This commit is contained in:
@@ -398,3 +398,15 @@ func RelayNotImplemented(c *gin.Context) {
|
||||
"error": err,
|
||||
})
|
||||
}
|
||||
|
||||
func RelayNotFound(c *gin.Context) {
|
||||
err := OpenAIError{
|
||||
Message: fmt.Sprintf("API not found: %s:%s", c.Request.Method, c.Request.URL.Path),
|
||||
Type: "one_api_error",
|
||||
Param: "",
|
||||
Code: "api_not_found",
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"error": err,
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user