Skip to content

Commit 3d0fb6b

Browse files
authored
Merge pull request #11 from Acring/fix/file-upload-timeout
fix(client): increase timeout for file upload requests
2 parents f043629 + 5a09894 commit 3d0fb6b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/client/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const (
1616
BaseURL = "https://api.notion.com"
1717
NotionVersion = "2022-06-28"
1818
DefaultTimeout = 30 * time.Second
19+
UploadTimeout = 5 * time.Minute
1920
)
2021

2122
type Client struct {
@@ -322,7 +323,10 @@ func (c *Client) UploadFileContent(uploadID, fileName, contentType string, fileB
322323
fmt.Printf("→ POST %s (multipart, %d bytes)\n", url, body.Len())
323324
}
324325

326+
origTimeout := c.httpClient.Timeout
327+
c.httpClient.Timeout = UploadTimeout
325328
resp, err := c.httpClient.Do(req)
329+
c.httpClient.Timeout = origTimeout
326330
if err != nil {
327331
return nil, fmt.Errorf("upload request failed: %w", err)
328332
}

0 commit comments

Comments
 (0)