From 1a5c82e2d08accb6330c4164ab987b87157b10ed Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 May 2024 21:16:23 +0200 Subject: build: bake git hash into build for headers and --version --- internal/importer/http.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'internal/importer/http.go') diff --git a/internal/importer/http.go b/internal/importer/http.go index 6d60c44..b496177 100644 --- a/internal/importer/http.go +++ b/internal/importer/http.go @@ -6,6 +6,7 @@ import ( "log/slog" "net/http" "os" + "searchix/internal/config" "searchix/internal/file" "strings" "time" @@ -29,6 +30,8 @@ func fetchFileIfNeeded(ctx context.Context, path string, url string) (needed boo return false, errors.WithMessagef(err, "could not create HTTP request for %s", url) } + req.Header.Set("User-Agent", fmt.Sprintf("Searchix %s", config.ShortSHA)) + if mtime != "" { req.Header.Set("If-Modified-Since", mtime) } -- cgit 1.4.1