Skip to content

Commit

Permalink
scripts: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Mar 28, 2023
1 parent a788e5e commit 547b827
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/translations/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ func uploadMultiPart(uri *url.URL, formData map[string]string, basePath string)
return fmt.Errorf("opening file: %w", err)
}

defer func() {
err = errors.WithDeferred(err, file.Close())
}()

fw, err = w.CreateFormFile("file", basePath)
_, err = io.Copy(fw, file)
if err != nil {
Expand All @@ -492,8 +496,7 @@ func uploadMultiPart(uri *url.URL, formData map[string]string, basePath string)
return fmt.Errorf("bad request: %w", err)
}

req.Header.Add("Content-Type", w.FormDataContentType())
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("Content-Type", w.FormDataContentType())

resp, err := client.Do(req)
if err != nil {
Expand Down

0 comments on commit 547b827

Please sign in to comment.