File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 9292// Resty also provides an options to override most of the client settings
9393// at request level.
9494type Client struct {
95- HostURL string
95+ BaseURL string
96+ HostURL string // Deprecated: use BaseURL instead. To be removed in v3.0.0 release.
9697 QueryParam url.Values
9798 FormData url.Values
9899 Header http.Header
@@ -154,8 +155,25 @@ type User struct {
154155//
155156// // Setting HTTPS address
156157// client.SetHostURL("https://myjeeva.com")
158+ //
159+ // Deprecated: use SetBaseURL instead. To be removed in v3.0.0 release.
157160func (c * Client ) SetHostURL (url string ) * Client {
158- c .HostURL = strings .TrimRight (url , "/" )
161+ c .SetBaseURL (url )
162+ return c
163+ }
164+
165+ // SetBaseURL method is to set Base URL in the client instance. It will be used with request
166+ // raised from this client with relative URL
167+ // // Setting HTTP address
168+ // client.SetBaseURL("http://myjeeva.com")
169+ //
170+ // // Setting HTTPS address
171+ // client.SetBaseURL("https://myjeeva.com")
172+ //
173+ // Since v2.7.0
174+ func (c * Client ) SetBaseURL (url string ) * Client {
175+ c .BaseURL = strings .TrimRight (url , "/" )
176+ c .HostURL = c .BaseURL
159177 return c
160178}
161179
You can’t perform that action at this time.
0 commit comments