diff options
author | siddharth ravikumar <s@ricketyspace.net> | 2022-11-26 09:03:33 -0500 |
---|---|---|
committer | siddharth ravikumar <s@ricketyspace.net> | 2022-11-26 09:03:33 -0500 |
commit | 6a37490876348c6a5834a727430dab860b3d68b5 (patch) | |
tree | d10eda7379c6d9d33b91e6df21fdc1ccebdd7e87 | |
parent | b1cf0985e27c0bcb6a1005ef9dd59e496ff05368 (diff) |
feed: update `Feed.get`
Add User-Agent header for the http GET call.
-rw-r--r-- | feed/feed.go | 9 |
1 files changed, 8 insertions, 1 deletions
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 } |