diff --git a/client/request.go b/client/request.go index 45787f4dc13..d58adea4210 100644 --- a/client/request.go +++ b/client/request.go @@ -27,6 +27,7 @@ var ( ErrServerError = errors.New("miniflux: internal server error") ErrNotFound = errors.New("miniflux: resource not found") ErrBadRequest = errors.New("miniflux: bad request") + ErrWrongEndpoint = errors.New("miniflux: endpoint badly configured") ) type errorResponse struct { @@ -62,6 +63,10 @@ func (r *request) Delete(path string) error { } func (r *request) execute(method, path string, data interface{}) (io.ReadCloser, error) { + // If we end up with an empty string as an endpoint, it's an user input error + if r.endpoint == "" { + return nil, ErrWrongEndpoint + } if r.endpoint[len(r.endpoint)-1:] == "/" { r.endpoint = r.endpoint[:len(r.endpoint)-1] }