Skip to content

Commit 8014dd5

Browse files
fix: uploadthing request no longer closes body
1 parent 94b41ba commit 8014dd5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func parseUploadthingFileResponse(resp *http.Response) (UploadthingFileResponse,
130130
return UploadthingFileResponse{}, fmt.Errorf("response is nil")
131131
}
132132
defer resp.Body.Close()
133+
fmt.Println(resp.Body)
133134
body, err := io.ReadAll(resp.Body)
134135
if err != nil {
135136
return UploadthingFileResponse{}, fmt.Errorf("error reading response body: %v", err)
@@ -319,7 +320,6 @@ func (ut *UtApi) requestUploadthing(pathname string, body *bytes.Buffer) (*http.
319320
if err != nil {
320321
return nil, err
321322
}
322-
defer resp.Body.Close()
323323
if resp.StatusCode != http.StatusOK {
324324
resp_body := bytes.NewBuffer([]byte{})
325325
_, err := io.Copy(resp_body, resp.Body)

0 commit comments

Comments
 (0)