Skip to content

Commit

Permalink
nifcloud: fix API requests (#2039)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored Oct 18, 2023
1 parent 52990b3 commit c9ff534
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions providers/dns/nifcloud/internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,17 @@ func (c *Client) sign(req *http.Request) error {
}

func newXMLRequest(ctx context.Context, method string, endpoint *url.URL, payload any) (*http.Request, error) {
buf := new(bytes.Buffer)
body := new(bytes.Buffer)

if payload != nil {
body := new(bytes.Buffer)
body.WriteString(xml.Header)
err := xml.NewEncoder(body).Encode(payload)
if err != nil {
return nil, fmt.Errorf("failed to create request XML body: %w", err)
}
}

req, err := http.NewRequestWithContext(ctx, method, endpoint.String(), buf)
req, err := http.NewRequestWithContext(ctx, method, endpoint.String(), body)
if err != nil {
return nil, fmt.Errorf("unable to create request: %w", err)
}
Expand Down

0 comments on commit c9ff534

Please sign in to comment.