fix error response code
This commit is contained in:
@@ -76,6 +76,9 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
|
|||||||
if !haveResponse {
|
if !haveResponse {
|
||||||
log.Println("Timeout upstream", upstream.Endpoint)
|
log.Println("Timeout upstream", upstream.Endpoint)
|
||||||
errCtx = errors.New("timeout")
|
errCtx = errors.New("timeout")
|
||||||
|
if shouldResponse {
|
||||||
|
c.AbortWithError(502, errCtx)
|
||||||
|
}
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -130,8 +133,6 @@ func processRequest(c *gin.Context, upstream *OPENAI_UPSTREAM, record *Record, s
|
|||||||
haveResponse = true
|
haveResponse = true
|
||||||
log.Println("Error", err, upstream.SK, upstream.Endpoint)
|
log.Println("Error", err, upstream.SK, upstream.Endpoint)
|
||||||
|
|
||||||
log.Println("debug", r)
|
|
||||||
|
|
||||||
errCtx = err
|
errCtx = err
|
||||||
|
|
||||||
// abort to error handle
|
// abort to error handle
|
||||||
|
|||||||
Reference in New Issue
Block a user