mirror of
https://github.com/labstack/echo.git
synced 2024-11-28 08:38:39 +02:00
Refactor DefaultProxyConfig Skipper & WebSocket Check in Context (#1297)
* refactor: default to DefaultProxyConfig.Skipper if not provided * refactor: use strings library for websocket check
This commit is contained in:
parent
802fb5bba6
commit
775b2eefec
@ -234,7 +234,7 @@ func (c *context) IsTLS() bool {
|
||||
|
||||
func (c *context) IsWebSocket() bool {
|
||||
upgrade := c.request.Header.Get(HeaderUpgrade)
|
||||
return upgrade == "websocket" || upgrade == "Websocket"
|
||||
return strings.ToLower(upgrade) == "websocket"
|
||||
}
|
||||
|
||||
func (c *context) Scheme() string {
|
||||
|
@ -200,7 +200,7 @@ func Proxy(balancer ProxyBalancer) echo.MiddlewareFunc {
|
||||
func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc {
|
||||
// Defaults
|
||||
if config.Skipper == nil {
|
||||
config.Skipper = DefaultLoggerConfig.Skipper
|
||||
config.Skipper = DefaultProxyConfig.Skipper
|
||||
}
|
||||
if config.Balancer == nil {
|
||||
panic("echo: proxy middleware requires balancer")
|
||||
|
Loading…
Reference in New Issue
Block a user