summaryrefslogtreecommitdiff
path: root/http_getter/http_getter.go
blob: 5df3ac24a5448ceff0e738182c4ea2137f924b45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
}