func (s *Sling) Path(path string) *Sling {
	baseURL, baseErr := url.Parse(s.rawURL)
	pathURL, pathErr := url.Parse(path)
	if baseErr == nil && pathErr == nil {
		s.rawURL = baseURL.ResolveReference(pathURL).String()
		return s
	}
	return s
}
Path extends the rawURL with the given path by resolving the reference to
an absolute URL. If parsing errors occur, the rawURL is left unmodified.
package sling
import (
	"encoding/base64"
	"encoding/json"
	"io"
	"net/http"
	"net/url"
	goquery "github.com/google/go-querystring/query"
)
const (
	contentType     = "Content-Type"
	jsonContentType = "application/json"
	formContentType = "application/x-www-form-urlencoded"
)
type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}
type Sling struct {
	httpClient Doer
	method string
	rawURL string
	header http.Header
	queryStructs []interface{}
	bodyProvider BodyProvider
}
func New() *Sling {
	return &Sling{
		httpClient:   http.DefaultClient,
		method:       "GET",
		header:       make(http.Header),
		queryStructs: make([]interface{}, 0),
	}
}
func (s *Sling) New() *Sling {
	headerCopy := make(http.Header)
	for k, v := range s.header {
		headerCopy[k] = v
	}
	return &Sling{
		httpClient:   s.httpClient,
		method:       s.method,
		rawURL:       s.rawURL,
		header:       headerCopy,
		queryStructs: append([]interface{}{}, s.queryStructs...),
		bodyProvider: s.bodyProvider,
	}
}
func (s *Sling) Client(httpClient *http.Client) *Sling {
	if httpClient == nil {
		return s.Doer(http.DefaultClient)
	}
	return s.Doer(httpClient)
}
func (s *Sling) Doer(doer Doer) *Sling {
	if doer == nil {
		s.httpClient = http.DefaultClient
	} else {
		s.httpClient = doer
	}
	return s
}
func (s *Sling) Head(pathURL string) *Sling {
	s.method = "HEAD"
	return s.Path(pathURL)
}
func (s *Sling) Get(pathURL string) *Sling {
	s.method = "GET"
	return s.Path(pathURL)
}
func (s *Sling) Post(pathURL string) *Sling {
	s.method = "POST"
	return s.Path(pathURL)
}
func (s *Sling) Put(pathURL string) *Sling {
	s.method = "PUT"
	return s.Path(pathURL)
}
func (s *Sling) Patch(pathURL string) *Sling {
	s.method = "PATCH"
	return s.Path(pathURL)
}
func (s *Sling) Delete(pathURL string) *Sling {
	s.method = "DELETE"
	return s.Path(pathURL)
}
func (s *Sling) Options(pathURL string) *Sling {
	s.method = "OPTIONS"
	return s.Path(pathURL)
}
func (s *Sling) Trace(pathURL string) *Sling {
	s.method = "TRACE"
	return s.Path(pathURL)
}
func (s *Sling) Connect(pathURL string) *Sling {
	s.method = "CONNECT"
	return s.Path(pathURL)
}
func (s *Sling) Add(key, value string) *Sling {
	s.header.Add(key, value)
	return s
}
func (s *Sling) Set(key, value string) *Sling {
	s.header.Set(key, value)
	return s
}
func (s *Sling) SetBasicAuth(username, password string) *Sling {
	return s.Set("Authorization", "Basic "+basicAuth(username, password))
}
func basicAuth(username, password string) string {
	auth := username + ":" + password
	return base64.StdEncoding.EncodeToString([]byte(auth))
}
func (s *Sling) Base(rawURL string) *Sling {
	s.rawURL = rawURL
	return s
}