mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 22:14:53 +00:00
feat: add user-agent http header for thirdparty sdks
This commit is contained in:
@@ -28,7 +28,8 @@ func NewClient(serverUrl, username, password string) *Client {
|
||||
password: password,
|
||||
}
|
||||
client.client = resty.New().
|
||||
SetBaseURL(strings.TrimRight(serverUrl, "/") + "/prod-api").
|
||||
SetBaseURL(strings.TrimRight(serverUrl, "/")+"/prod-api").
|
||||
SetHeader("User-Agent", "certimate").
|
||||
SetPreRequestHook(func(c *resty.Client, req *http.Request) error {
|
||||
if client.accessToken != "" {
|
||||
req.Header.Set("Authorization", "Bearer "+client.accessToken)
|
||||
|
@@ -28,7 +28,8 @@ func NewClient(serverUrl, username, password string) *Client {
|
||||
password: password,
|
||||
}
|
||||
client.client = resty.New().
|
||||
SetBaseURL(strings.TrimRight(serverUrl, "/") + "/prod-api").
|
||||
SetBaseURL(strings.TrimRight(serverUrl, "/")+"/prod-api").
|
||||
SetHeader("User-Agent", "certimate").
|
||||
SetPreRequestHook(func(c *resty.Client, req *http.Request) error {
|
||||
if client.accessToken != "" {
|
||||
req.Header.Set("Authorization", "Bearer "+client.accessToken)
|
||||
|
Reference in New Issue
Block a user