更新
This commit is contained in:
@@ -120,6 +120,7 @@ func (r *CommonResponse) IsSuccess() bool {
|
||||
// request 发送 HTTP 请求
|
||||
//
|
||||
// 为什么不使用 common/http 包:
|
||||
//
|
||||
// 1. common/http/http.go:61 会用内部请求的Authorization覆盖RAGFlow API key:
|
||||
// Httpclient.SetHeader("Authorization", g.RequestFromCtx(ctx).GetHeader("Authorization"))
|
||||
// 这会导致RAGFlow API认证失败,因为内部token不是RAGFlow的API key
|
||||
@@ -162,7 +163,12 @@ func (c *Client) request(ctx context.Context, method, path string, body interfac
|
||||
case "PUT":
|
||||
response, err = client.Put(ctx, fullURL, body)
|
||||
case "DELETE":
|
||||
response, err = client.Delete(ctx, fullURL, body)
|
||||
// DELETE请求需要明确使用ContentJson发送body
|
||||
if body != nil {
|
||||
response, err = client.ContentJson().Delete(ctx, fullURL, body)
|
||||
} else {
|
||||
response, err = client.Delete(ctx, fullURL)
|
||||
}
|
||||
default:
|
||||
return gerror.Newf("unsupported method: %s", method)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user