Response.JoinURL simplified.
This commit is contained in:
parent
3c9a3849e2
commit
16265e524d
@ -23,12 +23,10 @@ type Response struct {
|
||||
|
||||
// JoinURL joins base response URL and provided relative URL.
|
||||
func (r *Response) JoinURL(relativeURL string) (*url.URL, error) {
|
||||
parsedRelativeURL, err := url.Parse(relativeURL)
|
||||
joinedURL, err := r.Request.URL.Parse(relativeURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
joinedURL := r.Request.URL.ResolveReference(parsedRelativeURL)
|
||||
return joinedURL, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user