Skip to content

Commit

Permalink
fix(aggregator): omit empty headers from the request
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarlier committed Jun 15, 2020
1 parent f4ec387 commit e83c177
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/aggregator/handler.go
Expand Up @@ -73,8 +73,12 @@ func (fh *FeedHandler) Refresh() (FeedStatus, []*model.Article) {
req.Header.Set("User-Agent", common.UserAgent)

// Add cache headers
req.Header.Add("If-Modified-Since", fh.status.LastModifiedHeader)
req.Header.Add("If-None-Match", fh.status.EtagHeader)
if fh.status.LastModifiedHeader != "" {
req.Header.Add("If-Modified-Since", fh.status.LastModifiedHeader)
}
if fh.status.EtagHeader != "" {
req.Header.Add("If-None-Match", fh.status.EtagHeader)
}

// Do HTTP call
resp, err := http.DefaultClient.Do(req)
Expand Down

0 comments on commit e83c177

Please sign in to comment.