1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2025-06-08 23:46:12 +02:00

Add User-Agent HTTP req header

This commit is contained in:
David Stotijn 2021-05-14 18:25:44 +02:00
parent fccdde0f5b
commit 56b18f60ee

View File

@ -9,6 +9,7 @@ import (
const ( const (
baseURL = "https://api.notion.com/v1" baseURL = "https://api.notion.com/v1"
apiVersion = "2021-05-13" apiVersion = "2021-05-13"
clientVersion = "0.0.0"
) )
// Client is used for HTTP requests to the Notion API. // Client is used for HTTP requests to the Notion API.
@ -49,6 +50,7 @@ func (c *Client) newRequest(method, url string, body io.Reader) (*http.Request,
req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", c.apiKey)) req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", c.apiKey))
req.Header.Set("Notion-Version", apiVersion) req.Header.Set("Notion-Version", apiVersion)
req.Header.Set("User-Agent", "go-notion/"+clientVersion)
return req, nil return req, nil
} }