Skip to content

Commit

Permalink
Merge pull request #2 from foomo/feature/set-base-url
Browse files Browse the repository at this point in the history
* add a setter to change the clients base-url after creation
  • Loading branch information
cvidmar authored Oct 4, 2021
2 parents 4b8749e + eb17009 commit 5d85960
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 5d85960

Please sign in to comment.