summaryrefslogtreecommitdiff
path: root/http_getter
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-10-04 22:58:03 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-10-04 22:58:03 +0200
commit5b456afb49bfa6ff1567510bc1d9362377d32216 (patch)
treee9f13973251405095dd8b0a31930ca10caa57163 /http_getter
parent1f700deeb1a26ab289178b76518a33faa3f51545 (diff)
downloadstartpage-5b456afb49bfa6ff1567510bc1d9362377d32216.tar.gz
startpage-5b456afb49bfa6ff1567510bc1d9362377d32216.tar.bz2
startpage-5b456afb49bfa6ff1567510bc1d9362377d32216.zip
New config format and new features
We're now using json as a config format instead of our weird own format. The weather icon is now optional, simply don't define WeatherPlace in your config. You can now specify which subreddit to get background images from. The default is still /r/EarthPorn.
Diffstat (limited to 'http_getter')
-rw-r--r--http_getter/http_getter.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/http_getter/http_getter.go b/http_getter/http_getter.go
new file mode 100644
index 0000000..5df3ac2
--- /dev/null
+++ b/http_getter/http_getter.go
@@ -0,0 +1,19 @@
+package http_getter
+
+import (
+ "net/http"
+)
+
+// Get is like http.Get, but we're sending our own user agent.
+func Get(url string) (*http.Response, error) {
+ client := &http.Client{}
+
+ req, err := http.NewRequest("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ req.Header.Add("User-Agent", "github.com/slivasur/startpage")
+
+ return client.Do(req)
+}