Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: incorrect data type in UpdateCustomNameserverZoneMetadataParams #1410

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1410.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
custom_nameservers: change `NSSet` from string to int to match API response
```
11 changes: 4 additions & 7 deletions custom_nameservers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ type CustomNameserverResult struct {
}

type CustomNameserverZoneMetadata struct {
Type string `json:"type"`
NSSet string `json:"ns_set"`
Enabled bool `json:"enabled"`
NSSet int `json:"ns_set"`
Enabled bool `json:"enabled"`
}

type customNameserverListResponse struct {
Expand Down Expand Up @@ -68,9 +67,8 @@ type GetEligibleZonesAccountCustomNameserversParams struct{}
type GetCustomNameserverZoneMetadataParams struct{}

type UpdateCustomNameserverZoneMetadataParams struct {
Type string `json:"type"`
NSSet string `json:"ns_set"`
Enabled bool `json:"enabled"`
NSSet int `json:"ns_set"`
Enabled bool `json:"enabled"`
}

// GetCustomNameservers lists custom nameservers.
Expand Down Expand Up @@ -200,7 +198,6 @@ func (api *API) UpdateCustomNameserverZoneMetadata(ctx context.Context, rc *Reso

uri := fmt.Sprintf("/%s/%s/custom_ns", rc.Level, rc.Identifier)

params.Type = ""
_, err := api.makeRequestContext(ctx, http.MethodPut, uri, params)
if err != nil {
return err
Expand Down
6 changes: 2 additions & 4 deletions custom_nameservers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ func TestAccountCustomNameserver_GetAccountCustomNameserverZoneMetadata(t *testi
w.Header().Set("content-type", "application/json")
fmt.Fprintf(w, `{
"result": {
"type": "account",
"ns_set": "1",
"ns_set": 1,
"enabled": true
},
"success": true,
Expand All @@ -208,8 +207,7 @@ func TestAccountCustomNameserver_GetAccountCustomNameserverZoneMetadata(t *testi

mux.HandleFunc("/zones/"+testZoneID+"/custom_ns", handler)
want := CustomNameserverZoneMetadata{
Type: "account",
NSSet: "1",
NSSet: 1,
Enabled: true,
}

Expand Down