This commit is contained in:
Cold
2026-01-13 10:16:35 +08:00
committed by 张斌
parent bf8b220a99
commit 830d07c23d

View File

@@ -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)
}