add utils.newPathError
This commit is contained in:
parent
c23fd5a8be
commit
73f473fc51
5
utils.go
5
utils.go
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"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()))
|
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 {
|
func FixSlash(s string) string {
|
||||||
if !strings.HasSuffix(s, "/") {
|
if !strings.HasSuffix(s, "/") {
|
||||||
s += "/"
|
s += "/"
|
||||||
|
Loading…
Reference in New Issue
Block a user