From 6a37490876348c6a5834a727430dab860b3d68b5 Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sat, 26 Nov 2022 09:03:33 -0500 Subject: feed: update `Feed.get` Add User-Agent header for the http GET call. --- feed/feed.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'feed') diff --git a/feed/feed.go b/feed/feed.go index ac48df9..5e997ea 100644 --- a/feed/feed.go +++ b/feed/feed.go @@ -15,6 +15,7 @@ import ( "ricketyspace.net/fern/schema" "ricketyspace.net/fern/state" + "ricketyspace.net/fern/version" ) type Feed struct { @@ -76,7 +77,13 @@ func (feed *Feed) get() ([]byte, error) { // Init byte container to store feed content. bs := make([]byte, 0) - resp, err := http.Get(feed.Source) + req, err := http.NewRequest("GET", feed.Source, nil) + if err != nil { + return bs, err + } + req.Header.Set("User-Agent", "fern/"+version.Version) + client := http.Client{} + resp, err := client.Do(req) if err != nil { return bs, err } -- cgit v1.2.3