Fix lint warning by renaming MaxBytesExceededErr -> ErrMaxBytesExceeded ()

Signed-off-by: Jonas Östanbäck <jonas.ostanback@gmail.com>
This commit is contained in:
Jonas Östanbäck 2017-05-17 17:57:11 +02:00 committed by Matt Holt
parent a3b2a6a296
commit 05ea5c32be
5 changed files with 8 additions and 8 deletions

View file

@ -302,7 +302,7 @@ func (r *replacer) getSubstitution(key string) string {
}
_, err := ioutil.ReadAll(r.request.Body)
if err != nil {
if err == MaxBytesExceededErr {
if err == ErrMaxBytesExceeded {
return r.emptyValue
}
}

View file

@ -478,9 +478,9 @@ func (ln tcpKeepAliveListener) File() (*os.File, error) {
return ln.TCPListener.File()
}
// MaxBytesExceeded is the error returned by MaxBytesReader
// ErrMaxBytesExceeded is the error returned by MaxBytesReader
// when the request body exceeds the limit imposed
var MaxBytesExceededErr = errors.New("http: request body too large")
var ErrMaxBytesExceeded = errors.New("http: request body too large")
// DefaultErrorFunc responds to an HTTP request with a simple description
// of the specified HTTP status code.

View file

@ -31,7 +31,7 @@ func (l Limit) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
// MaxBytesReader and its associated methods are borrowed from the
// Go Standard library (comments intact). The only difference is that
// it returns a MaxBytesExceeded error instead of a generic error message
// it returns a ErrMaxBytesExceeded error instead of a generic error message
// when the request body has exceeded the requested limit
func MaxBytesReader(w http.ResponseWriter, r io.ReadCloser, n int64) io.ReadCloser {
return &maxBytesReader{w: w, r: r, n: n}
@ -81,7 +81,7 @@ func (l *maxBytesReader) Read(p []byte) (n int, err error) {
if res, ok := l.w.(requestTooLarger); ok {
res.requestTooLarge()
}
l.err = httpserver.MaxBytesExceededErr
l.err = httpserver.ErrMaxBytesExceeded
return n, l.err
}

View file

@ -29,7 +29,7 @@ func TestBodySizeLimit(t *testing.T) {
if got := string(gotContent); got != expectContent {
t.Errorf("expected content[%s], got[%s]", expectContent, got)
}
if gotError != httpserver.MaxBytesExceededErr {
t.Errorf("expect error %v, got %v", httpserver.MaxBytesExceededErr, gotError)
if gotError != httpserver.ErrMaxBytesExceeded {
t.Errorf("expect error %v, got %v", httpserver.ErrMaxBytesExceeded, gotError)
}
}

View file

@ -228,7 +228,7 @@ func (p Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
return 0, nil
}
if backendErr == httpserver.MaxBytesExceededErr {
if backendErr == httpserver.ErrMaxBytesExceeded {
return http.StatusRequestEntityTooLarge, backendErr
}