mirror of
https://github.com/usual2970/certimate.git
synced 2025-09-03 15:01:45 +00:00
refactor: clean code
This commit is contained in:
@@ -22,13 +22,13 @@ type Client struct {
|
||||
client *resty.Client
|
||||
}
|
||||
|
||||
func NewClient(apiHost, username, password string) *Client {
|
||||
func NewClient(serverUrl, username, password string) *Client {
|
||||
client := &Client{
|
||||
username: username,
|
||||
password: password,
|
||||
}
|
||||
client.client = resty.New().
|
||||
SetBaseURL(strings.TrimRight(apiHost, "/") + "/prod-api").
|
||||
SetBaseURL(strings.TrimRight(serverUrl, "/") + "/prod-api").
|
||||
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