From 44c311570982a891b8bdd7001087e1c0c7a51af8 Mon Sep 17 00:00:00 2001 From: AI Engineer Date: Sat, 9 May 2026 21:01:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E5=86=85=E5=AD=98?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E4=B8=8E=E5=BA=95=E5=B1=82=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=88by=20AI=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 6f52946..3ff93e6 100644 --- a/client.go +++ b/client.go @@ -380,7 +380,12 @@ func (client *Client) writeMultipartPart(writer *multipart.Writer, key string, v if err != nil { return err } - return writer.WriteField(key, string(bytesData)) + part, err := writer.CreateFormField(key) + if err != nil { + return err + } + _, err = part.Write(bytesData) + return err } } @@ -471,7 +476,7 @@ func (client *Client) do(fetchBody bool, method, url string, data any, headers . }() default: bytesData, _ := cast.ToJSONBytes(data) - if len(bytesData) > 0 && string(bytesData) != "null" { + if len(bytesData) > 0 && !bytes.Equal(bytesData, []byte("null")) { reader = bytes.NewReader(bytesData) contentType = "application/json" contentLength = len(bytesData)