summaryrefslogtreecommitdiff
path: root/http_getter
diff options
context:
space:
mode:
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)
+}