Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit e275b86

Browse files
committed
Check for response status in Client.Store() method
1 parent 8fcda3b commit e275b86

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ func (c *Client) Store(req Request, dest string) error {
110110
if err != nil {
111111
return err
112112
}
113+
// Check for 2XX Status Codes
114+
if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
115+
return errors.New("cannot convert file to PDF")
116+
}
113117
return writeNewFile(dest, resp.Body)
114118
}
115119

0 commit comments

Comments
 (0)