From c9ff534e393a838e79eedd6935d6c61c94a18fab Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Wed, 18 Oct 2023 11:53:04 +0200 Subject: [PATCH] nifcloud: fix API requests (#2039) --- providers/dns/nifcloud/internal/client.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/providers/dns/nifcloud/internal/client.go b/providers/dns/nifcloud/internal/client.go index 3ad95488..02d11fea 100644 --- a/providers/dns/nifcloud/internal/client.go +++ b/providers/dns/nifcloud/internal/client.go @@ -149,10 +149,9 @@ 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 { @@ -160,7 +159,7 @@ func newXMLRequest(ctx context.Context, method string, endpoint *url.URL, payloa } } - 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) }