From 6b376a18e08466b969e119f2f042aa840a1749fe Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Thu, 18 Nov 2021 09:43:44 +0100 Subject: [PATCH] Using ioutil.NopCloser set content-length header to 0, which is no more accepted by the backend. Signed-off-by: Silvin Lubecki --- pkg/hub/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/hub/client.go b/pkg/hub/client.go index d95b906..0f8f098 100644 --- a/pkg/hub/client.go +++ b/pkg/hub/client.go @@ -214,7 +214,7 @@ func (c *Client) Login(username string, password string, twoFactorCodeProvider f body := bytes.NewBuffer(data) // Login on the Docker Hub - req, err := http.NewRequest("POST", c.domain+LoginURL, ioutil.NopCloser(body)) + req, err := http.NewRequest("POST", c.domain+LoginURL, body) if err != nil { return "", "", err } @@ -270,7 +270,7 @@ func (c *Client) getTwoFactorToken(token string, twoFactorCodeProvider func() (s body := bytes.NewBuffer(data) // Request 2FA on the Docker Hub - req, err := http.NewRequest("POST", c.domain+TwoFactorLoginURL, ioutil.NopCloser(body)) + req, err := http.NewRequest("POST", c.domain+TwoFactorLoginURL, body) if err != nil { return "", "", err }