add new authentication header test; fix #1

This commit is contained in:
aler9
2020-07-18 12:10:29 +02:00
parent 32d4cc1593
commit 99f809e50e

View File

@@ -63,7 +63,7 @@ var casesHeaderAuth = []struct {
},
},
{
"digest response 1",
"digest response generic",
`Digest username="aa", realm="bb", nonce="cc", uri="dd", response="ee"`,
`Digest realm="bb", nonce="cc", response="ee", uri="dd", username="aa"`,
&HeaderAuth{
@@ -92,6 +92,21 @@ var casesHeaderAuth = []struct {
},
},
},
{
"digest response with no spaces and additional fields",
`Digest realm="Please log in with a valid username",nonce="752a62306daf32b401a41004555c7663",opaque="",stale=FALSE,algorithm=MD5`,
`Digest realm="Please log in with a valid username", algorithm="MD5", nonce="752a62306daf32b401a41004555c7663", opaque="", stale="FALSE"`,
&HeaderAuth{
Prefix: "Digest",
Values: map[string]string{
"realm": "Please log in with a valid username",
"nonce": "752a62306daf32b401a41004555c7663",
"opaque": "",
"stale": "FALSE",
"algorithm": "MD5",
},
},
},
}
func TestHeaderAuthRead(t *testing.T) {