Skip to content

Commit

Permalink
Merge pull request #1410 from rwhelan/custom_ns_set_data_type
Browse files Browse the repository at this point in the history
fix: incorrect data type in UpdateCustomNameserverZoneMetadataParams
  • Loading branch information
jacobbednarz committed Oct 2, 2023
2 parents f2eb4f3 + fe6958b commit daee01d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
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

0 comments on commit daee01d

Please sign in to comment.