1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-04-21 12:07:01 +02:00

rm IsAbs check

This commit is contained in:
Shaun Dunning 2018-05-10 10:12:40 -04:00
parent 2e5459f891
commit a0af595623

14
jira.go
View File

@ -8,11 +8,11 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"reflect" "reflect"
"strings"
"time" "time"
"github.com/google/go-querystring/query" "github.com/google/go-querystring/query"
"github.com/pkg/errors" "github.com/pkg/errors"
"strings"
) )
// A Client manages communication with the JIRA API. // A Client manages communication with the JIRA API.
@ -84,9 +84,7 @@ func (c *Client) NewRawRequest(method, urlStr string, body io.Reader) (*http.Req
return nil, err return nil, err
} }
// Relative URLs should be specified without a preceding slash since baseURL will have the trailing slash // Relative URLs should be specified without a preceding slash since baseURL will have the trailing slash
if !rel.IsAbs() { rel.Path = strings.TrimLeft(rel.Path, "/")
rel.Path = strings.TrimLeft(rel.Path, "/")
}
u := c.baseURL.ResolveReference(rel) u := c.baseURL.ResolveReference(rel)
@ -124,9 +122,7 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Requ
return nil, err return nil, err
} }
// Relative URLs should be specified without a preceding slash since baseURL will have the trailing slash // Relative URLs should be specified without a preceding slash since baseURL will have the trailing slash
if !rel.IsAbs() { rel.Path = strings.TrimLeft(rel.Path, "/")
rel.Path = strings.TrimLeft(rel.Path, "/")
}
u := c.baseURL.ResolveReference(rel) u := c.baseURL.ResolveReference(rel)
@ -195,9 +191,7 @@ func (c *Client) NewMultiPartRequest(method, urlStr string, buf *bytes.Buffer) (
return nil, err return nil, err
} }
// Relative URLs should be specified without a preceding slash since baseURL will have the trailing slash // Relative URLs should be specified without a preceding slash since baseURL will have the trailing slash
if !rel.IsAbs() { rel.Path = strings.TrimLeft(rel.Path, "/")
rel.Path = strings.TrimLeft(rel.Path, "/")
}
u := c.baseURL.ResolveReference(rel) u := c.baseURL.ResolveReference(rel)