Skip to content

Commit c9ff534

Browse files
authored
nifcloud: fix API requests (go-acme#2039)
1 parent 52990b3 commit c9ff534

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

providers/dns/nifcloud/internal/client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,17 @@ func (c *Client) sign(req *http.Request) error {
149149
}
150150

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

154154
if payload != nil {
155-
body := new(bytes.Buffer)
156155
body.WriteString(xml.Header)
157156
err := xml.NewEncoder(body).Encode(payload)
158157
if err != nil {
159158
return nil, fmt.Errorf("failed to create request XML body: %w", err)
160159
}
161160
}
162161

163-
req, err := http.NewRequestWithContext(ctx, method, endpoint.String(), buf)
162+
req, err := http.NewRequestWithContext(ctx, method, endpoint.String(), body)
164163
if err != nil {
165164
return nil, fmt.Errorf("unable to create request: %w", err)
166165
}

0 commit comments

Comments
 (0)