Skip to content

Commit 245607b

Browse files
committed
feat: include If-Modified-Since
1 parent 4c12801 commit 245607b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pkg/database/smart.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,18 @@ func (db *SmartDB) fetchModifiedIDs(since time.Time) ([]modifiedIDRow, error) {
153153
return nil, err
154154
}
155155

156+
req.Header.Add("If-Modified-Since", since.Format(http.TimeFormat))
157+
156158
resp, err := http.DefaultClient.Do(req)
157159
if err != nil {
158160
return nil, err
159161
}
160162

161163
defer resp.Body.Close()
162164

163-
if resp.StatusCode != http.StatusOK {
165+
if resp.StatusCode == http.StatusNotModified {
166+
return []modifiedIDRow{}, nil
167+
} else if resp.StatusCode != http.StatusOK {
164168
return nil, fmt.Errorf("%w (%s)", ErrUnexpectedStatusCode, resp.Status)
165169
}
166170

0 commit comments

Comments
 (0)