mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
fix(http): fix GET requests to use 'Accept' header (#1288)
use 'Accept' header instead of 'Content-Type' use 'Authorization' header only if we have credentials Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
parent
c91d4a0308
commit
a2c34808a5
1 changed files with 4 additions and 2 deletions
|
@ -147,9 +147,11 @@ func MakeHTTPGetRequest(httpClient *http.Client, username string, password strin
|
|||
return nil, 0, err
|
||||
}
|
||||
|
||||
req.Header.Set("Content-Type", mediaType)
|
||||
req.Header.Set("Accept", mediaType)
|
||||
|
||||
if username != "" && password != "" {
|
||||
req.SetBasicAuth(username, password)
|
||||
}
|
||||
|
||||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue