mirror of
https://github.com/labstack/echo.git
synced 2025-11-27 22:38:25 +02:00
fix: basic auth invalid base64 string (#2191)
* fix: basic auth returns 400 on invalid base64 string
This commit is contained in:
@@ -58,6 +58,12 @@ func TestBasicAuth(t *testing.T) {
|
||||
assert.Equal(http.StatusUnauthorized, he.Code)
|
||||
assert.Equal(basic+` realm="someRealm"`, res.Header().Get(echo.HeaderWWWAuthenticate))
|
||||
|
||||
// Invalid base64 string
|
||||
auth = basic + " invalidString"
|
||||
req.Header.Set(echo.HeaderAuthorization, auth)
|
||||
he = h(c).(*echo.HTTPError)
|
||||
assert.Equal(http.StatusBadRequest, he.Code)
|
||||
|
||||
// Missing Authorization header
|
||||
req.Header.Del(echo.HeaderAuthorization)
|
||||
he = h(c).(*echo.HTTPError)
|
||||
|
||||
Reference in New Issue
Block a user