This commit is contained in:
邹宗楠
2025-07-21 11:53:21 +08:00
parent 913c86da47
commit 82e055b194
2 changed files with 3 additions and 2 deletions

View File

@@ -104,6 +104,7 @@ func (a *API) FileUpload(filePath, imgType, sourcechnl, isOcr string) (*UploadIm
}
// 设置 Content-Type 头
a.CheckToken()
req.Header.Set("Content-Type", writer.FormDataContentType())
req.Header.Set("Authorization", fmt.Sprintf("bearer %s", a.incomingToken))

View File

@@ -78,8 +78,8 @@ func TestGetCustomAndCategoryList(t *testing.T) {
}
func TestUploadImg(t *testing.T) {
filePath := "https://image.jxc4.com/image/7325d87faa6179e0d86dad9ae27cbbc1.jpg"
data, err := api.FileUpload(filePath, IdCardFront, "0", "false")
filePath := "https://image.jxc4.com/image/3559d4696be3bf241ee6b89ca3713cf7.pdf"
data, err := api.FileUpload(filePath, "SPLIT_ENTRUST_FILE", "0", "false")
if err != nil {
fmt.Printf("Error: %v\n", err)
} else {