fix(provider): fixed wrong Kong response field type and optional ApiToken (#1372)

This commit is contained in:
Deny 2026-07-14 12:09:47 +08:00 committed by GitHub
parent 7d61452f66
commit d1a8e93f43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -31,9 +31,6 @@ func NewClient(serverUrl string, optFns ...OptionsFunc) (*Client, error) {
if _, err := url.Parse(serverUrl); err != nil {
return nil, fmt.Errorf("sdkerr: invalid serverUrl: %w", err)
}
if opts.ApiToken == "" {
return nil, fmt.Errorf("sdkerr: unset apiToken")
}
baseUrl := strings.TrimSuffix(serverUrl, "/")
if opts.Workspace != "" {
@ -44,8 +41,11 @@ func NewClient(serverUrl string, optFns ...OptionsFunc) (*Client, error) {
SetBaseURL(baseUrl).
SetHeader("Accept", "application/json").
SetHeader("Content-Type", "application/json").
SetHeader("User-Agent", app.AppUserAgent).
SetHeader("Kong-Admin-Token", opts.ApiToken)
SetHeader("User-Agent", app.AppUserAgent)
if opts.ApiToken != "" {
httper = httper.SetHeader("Kong-Admin-Token", opts.ApiToken)
}
return &Client{rc: httper}, nil
}

View File

@ -8,6 +8,6 @@ type Certificate struct {
KeyAlt *string `json:"key_alt,omitempty"`
SNIs []*string `json:"snis,omitempty"`
Tags []*string `json:"tags,omitempty"`
CreatedAt *string `json:"created_at,omitempty"`
UpdatedAt *string `json:"updated_at,omitempty"`
CreatedAt *int64 `json:"created_at,omitempty"`
UpdatedAt *int64 `json:"updated_at,omitempty"`
}