Skip to content

Commit

Permalink
* add a setter to change the clients base-url after creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dpool committed Oct 3, 2021
1 parent 4b8749e commit eb17009
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contentful.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ func (c *Contentful) SetHTTPTransport(t http.RoundTripper) *Contentful {
return c
}

// SetBaseURL provides an option to change the BaseURL of the client
func (c *Contentful) SetBaseURL(url string) *Contentful {
c.BaseURL = url
return c
}

func (c *Contentful) newRequest(method, path string, query url.Values, body io.Reader) (*http.Request, error) {
u, err := url.Parse(c.BaseURL)
if err != nil {
Expand Down

0 comments on commit eb17009

Please sign in to comment.