mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
feat(http): support empty passwords (#2206)
* add test case * allow zero-length passwords Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
parent
04599e97da
commit
b7afe8bbf5
@ -311,7 +311,7 @@ func (c *Client) createRequest(method, url string, body io.Reader, header *http.
|
||||
}
|
||||
}
|
||||
|
||||
if len(c.username) > 0 && len(c.password) > 0 {
|
||||
if len(c.username) > 0 {
|
||||
request.SetBasicAuth(c.username, c.password)
|
||||
c.logger.Debug("Using Basic Authentication ****/****")
|
||||
}
|
||||
|
@ -169,6 +169,7 @@ func TestUploadRequest(t *testing.T) {
|
||||
{clientOptions: ClientOptions{}, method: "POST", header: map[string][]string{"Testheader": {"Test1", "Test2"}}, expected: "OK"},
|
||||
{clientOptions: ClientOptions{}, cookies: []*http.Cookie{{Name: "TestCookie1", Value: "TestValue1"}, {Name: "TestCookie2", Value: "TestValue2"}}, method: "POST", expected: "OK"},
|
||||
{clientOptions: ClientOptions{Username: "TestUser", Password: "TestPwd"}, method: "POST", expected: "OK"},
|
||||
{clientOptions: ClientOptions{Username: "UserOnly", Password: ""}, method: "POST", expected: "OK"},
|
||||
}
|
||||
|
||||
client := Client{logger: log.Entry().WithField("package", "SAP/jenkins-library/pkg/http")}
|
||||
|
Loading…
Reference in New Issue
Block a user