chore: update linter.

This commit is contained in:
Ludovic Fernandez 2020-11-06 09:26:03 +01:00 committed by GitHub
parent f5b290b093
commit 267d0b7b5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 68 additions and 38 deletions

View file

@ -2,6 +2,7 @@ package service
import (
"context"
"errors"
"fmt"
"io"
"net"
@ -83,13 +84,14 @@ func buildProxy(passHostHeader *bool, responseForwarding *dynamic.ResponseForwar
statusCode := http.StatusInternalServerError
switch {
case err == io.EOF:
case errors.Is(err, io.EOF):
statusCode = http.StatusBadGateway
case err == context.Canceled:
case errors.Is(err, context.Canceled):
statusCode = StatusClientClosedRequest
default:
if e, ok := err.(net.Error); ok {
if e.Timeout() {
var netErr net.Error
if errors.As(err, &netErr) {
if netErr.Timeout() {
statusCode = http.StatusGatewayTimeout
} else {
statusCode = http.StatusBadGateway