Modify the test module, add the file upload test, and add the image edit api (#63)

* Modify the test module, add the file upload test, and add the image editing api

* fix golangci-lint

* fix golangci-lint

* Static file deletion, file directory name modification

* fix

* test-server-related logic encapsulated in a single tidy
 struct

---------

Co-authored-by: julian_huang <julian.huang@yuansuan.com>
This commit is contained in:
Rascal0814
2023-02-12 02:51:53 +08:00
committed by GitHub
parent ae06df7d9f
commit 5191ea6f55
12 changed files with 719 additions and 426 deletions

View File

@@ -9,7 +9,6 @@ import (
"net/http"
"net/url"
"os"
"strings"
)
type FileRequest struct {
@@ -56,13 +55,9 @@ func (c *Client) CreateFile(ctx context.Context, request FileRequest) (file File
var b bytes.Buffer
w := multipart.NewWriter(&b)
var fw, pw io.Writer
pw, err = w.CreateFormField("purpose")
if err != nil {
return
}
var fw io.Writer
_, err = io.Copy(pw, strings.NewReader(request.Purpose))
err = w.WriteField("purpose", request.Purpose)
if err != nil {
return
}