diff options
Diffstat (limited to 'spartan/response.go')
-rw-r--r-- | spartan/response.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spartan/response.go b/spartan/response.go index df565f9..a71c598 100644 --- a/spartan/response.go +++ b/spartan/response.go @@ -52,26 +52,26 @@ func ServerError(err error) *types.Response { } } -// InvalidResponseHeaderLine indicates a malformed spartan response line. -var InvalidResponseHeaderLine = errors.New("Invalid response header line.") +// ErrInvalidResponseHeaderLine indicates a malformed spartan response line. +var ErrInvalidResponseHeaderLine = errors.New("invalid response header line") -// InvalidResponseLineEnding indicates that a spartan response header didn't end with "\r\n". -var InvalidResponseLineEnding = errors.New("Invalid response line ending.") +// ErrInvalidResponseLineEnding indicates that a spartan response header didn't end with "\r\n". +var ErrInvalidResponseLineEnding = errors.New("invalid response line ending") func ParseResponse(rdr io.Reader) (*types.Response, error) { bufrdr := bufio.NewReader(rdr) hdrLine, err := bufrdr.ReadString('\n') if err != nil { - return nil, InvalidResponseLineEnding + return nil, ErrInvalidResponseLineEnding } if len(hdrLine) < 2 { - return nil, InvalidResponseHeaderLine + return nil, ErrInvalidResponseHeaderLine } status, err := strconv.Atoi(string(hdrLine[0])) if err != nil || hdrLine[1] != ' ' || hdrLine[len(hdrLine)-2:] != "\r\n" { - return nil, InvalidResponseHeaderLine + return nil, ErrInvalidResponseHeaderLine } return &types.Response{ |