add utils.newPathError
This commit is contained in:
parent
c23fd5a8be
commit
73f473fc51
5
utils.go
5
utils.go
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -16,6 +17,10 @@ func Error(r *http.Response) error {
|
||||
return errors.New(fmt.Sprintf("%s - %s %s", r.Status, r.Request.Method, r.Request.URL.String()))
|
||||
}
|
||||
|
||||
func newPathError(op string, path string, statusCode int) error {
|
||||
return &os.PathError{op, path, errors.New(fmt.Sprintf("%d", statusCode))}
|
||||
}
|
||||
|
||||
func FixSlash(s string) string {
|
||||
if !strings.HasSuffix(s, "/") {
|
||||
s += "/"
|
||||
|
Loading…
Reference in New Issue
Block a user