clearer error message

This commit is contained in:
aler9
2020-07-10 11:13:24 +02:00
parent 04b0a6eabe
commit fb7d7b008e

View File

@@ -83,8 +83,11 @@ func (as *AuthServer) GenerateHeader() []string {
// ValidateHeader validates the Authorization header sent by a client after receiving the
// WWW-Authenticate header provided by GenerateHeader().
func (as *AuthServer) ValidateHeader(header []string, method Method, ur *url.URL) error {
if len(header) != 1 {
return fmt.Errorf("authorization header not provided or provided multiple times")
if len(header) == 0 {
return fmt.Errorf("authorization header not provided")
}
if len(header) > 1 {
return fmt.Errorf("authorization header provided multiple times")
}
head := header[0]