1
0
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:
Hemachandar 2019-03-03 00:13:23 +05:30 committed by Vishal Rana
parent 802fb5bba6
commit 775b2eefec
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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")