From a9828c17b370e119aac495c67c9493bad15a4b45 Mon Sep 17 00:00:00 2001 From: Wallace Soares Date: Thu, 23 Jan 2025 10:46:59 -0300 Subject: [PATCH] Adding more info to user-agent --- incognia.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/incognia.go b/incognia.go index 91cef97..6c51a26 100644 --- a/incognia.go +++ b/incognia.go @@ -7,6 +7,7 @@ import ( "fmt" "io/ioutil" "net/http" + "runtime" "time" ) @@ -384,7 +385,18 @@ func (c *Client) registerLogin(login *Login) (*TransactionAssessment, error) { } func (c *Client) doRequest(request *http.Request, response interface{}) error { + libVersion := "1.16.1" // Replace this with actual lib version + + userAgent := fmt.Sprintf( + "incognia-api-go/%s (%s %s) Go/%s", + libVersion, + runtime.GOOS, + runtime.GOARCH, + runtime.Version(), + ) + request.Header.Add("Content-Type", "application/json") + request.Header.Add("user-agent", userAgent) err := c.authorizeRequest(request) if err != nil {