mirror of
https://github.com/labstack/echo.git
synced 2025-11-27 22:38:25 +02:00
Fixed basic auth to return 401 for error cases
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@@ -40,11 +40,11 @@ func TestBasicAuth(t *testing.T) {
|
||||
// Empty Authorization header
|
||||
req.Header().Set(echo.HeaderAuthorization, "")
|
||||
he = h(c).(*echo.HTTPError)
|
||||
assert.Equal(t, http.StatusBadRequest, he.Code)
|
||||
assert.Equal(t, http.StatusUnauthorized, he.Code)
|
||||
|
||||
// Invalid Authorization header
|
||||
auth = base64.StdEncoding.EncodeToString([]byte("invalid"))
|
||||
req.Header().Set(echo.HeaderAuthorization, auth)
|
||||
he = h(c).(*echo.HTTPError)
|
||||
assert.Equal(t, http.StatusBadRequest, he.Code)
|
||||
assert.Equal(t, http.StatusUnauthorized, he.Code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user