mirror of
https://github.com/labstack/echo.git
synced 2025-07-13 01:30:31 +02:00
Better handling in middleware for WebSocket
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@ -21,6 +21,11 @@ const (
|
||||
// For invalid credentials, it sends "401 - Unauthorized" response.
|
||||
func BasicAuth(fn AuthFunc) echo.HandlerFunc {
|
||||
return func(c *echo.Context) error {
|
||||
// Skip for WebSocket
|
||||
if (c.Request().Header.Get(echo.Upgrade)) == echo.WebSocket {
|
||||
return nil
|
||||
}
|
||||
|
||||
auth := c.Request().Header.Get(echo.Authorization)
|
||||
i := 0
|
||||
code := http.StatusBadRequest
|
||||
|
Reference in New Issue
Block a user