Skip to content

Commit

Permalink
epss: utilize NewRequestWithContext
Browse files Browse the repository at this point in the history
Signed-off-by: daynewlee <[email protected]>
  • Loading branch information
daynewlee committed Nov 22, 2024
1 parent 4214323 commit 9525df0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enricher/epss/epss.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (e *Enricher) FetchEnrichment(ctx context.Context, _ driver.Fingerprint) (i
hint := driver.Fingerprint(newUUID.String())
zlog.Info(ctx).Str("hint", string(hint)).Msg("starting fetch")

out, err := tmp.NewFile("", "enricher.epss.*.json")
out, err := tmp.NewFile("", "epss.")
if err != nil {
return nil, hint, err
}
Expand All @@ -127,7 +127,12 @@ func (e *Enricher) FetchEnrichment(ctx context.Context, _ driver.Fingerprint) (i
e.defaultURL()
}

resp, err := http.Get(e.feedPath)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, e.feedPath, nil)
if err != nil {
return nil, "", fmt.Errorf("unable to create request for %s: %w", e.feedPath, err)
}

resp, err := e.c.Do(req)
if err != nil {
return nil, "", fmt.Errorf("unable to fetch file from %s: %w", e.feedPath, err)
}
Expand Down

0 comments on commit 9525df0

Please sign in to comment.