Compare commits

...

2 Commits

Author SHA1 Message Date
888f29383e
add User-Agent header 2020-03-01 11:27:26 -06:00
0427121975
add proper Content-Type header 2020-03-01 11:23:59 -06:00

View File

@ -10,6 +10,8 @@ import (
"net/http" "net/http"
) )
const UserAgent = "go-lifx"
type ( type (
Client struct { Client struct {
accessToken string accessToken string
@ -56,6 +58,8 @@ func (c *Client) NewRequest(method, url string, body io.Reader) (req *http.Reque
return return
} }
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.accessToken)) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.accessToken))
req.Header.Add("Content-Type", "application/json")
req.Header.Add("User-Agent", UserAgent)
return return
} }