set useragent

This commit is contained in:
risk danger olson 2016-12-20 15:46:45 -07:00
parent 4f9af9e708
commit dda79b4c5a
2 changed files with 7 additions and 0 deletions

@ -4,6 +4,8 @@ import (
"fmt" "fmt"
"runtime" "runtime"
"strings" "strings"
"github.com/git-lfs/git-lfs/lfsapi"
) )
var ( var (
@ -28,4 +30,5 @@ func init() {
gitCommit, gitCommit,
) )
lfsapi.UserAgent = VersionDesc
} }

@ -13,7 +13,11 @@ import (
"github.com/rubyist/tracerx" "github.com/rubyist/tracerx"
) )
var UserAgent = "git-lfs"
func (c *Client) Do(req *http.Request) (*http.Response, error) { func (c *Client) Do(req *http.Request) (*http.Response, error) {
req.Header.Set("User-Agent", UserAgent)
res, err := c.doWithRedirects(c.httpClient(req.Host), req, nil) res, err := c.doWithRedirects(c.httpClient(req.Host), req, nil)
if err != nil { if err != nil {
return res, err return res, err