@@ -10,6 +10,7 @@ import (
1010 "net/http"
1111 "net/http/cookiejar"
1212 "net/url"
13+ "os"
1314 "time"
1415
1516 "golang.org/x/net/publicsuffix"
@@ -39,7 +40,7 @@ func New() *Client {
3940 Token : "" ,
4041 Cookies : make ([]* http.Cookie , 0 ),
4142 Debug : false ,
42- Log : getLogger (nil ),
43+ Log : getLogger (os . Stderr ),
4344 httpClient : & http.Client {Jar : cookieJar },
4445 transport : & http.Transport {},
4546 }
@@ -72,122 +73,122 @@ func R() *Request {
7273 return DefaultClient .R ()
7374}
7475
75- // SetHostURL sets Host URL. See Client.SetHostURL for more information.
76+ // SetHostURL sets Host URL. See ` Client.SetHostURL for more information.
7677func SetHostURL (url string ) * Client {
7778 return DefaultClient .SetHostURL (url )
7879}
7980
80- // SetHeader sets single header. See Client.SetHeader for more information.
81+ // SetHeader sets single header. See ` Client.SetHeader` for more information.
8182func SetHeader (header , value string ) * Client {
8283 return DefaultClient .SetHeader (header , value )
8384}
8485
85- // SetHeaders sets multiple headers. See Client.SetHeaders for more information.
86+ // SetHeaders sets multiple headers. See ` Client.SetHeaders` for more information.
8687func SetHeaders (headers map [string ]string ) * Client {
8788 return DefaultClient .SetHeaders (headers )
8889}
8990
90- // SetCookie sets single cookie object. See Client.SetCookie for more information.
91+ // SetCookie sets single cookie object. See ` Client.SetCookie` for more information.
9192func SetCookie (hc * http.Cookie ) * Client {
9293 return DefaultClient .SetCookie (hc )
9394}
9495
95- // SetCookies sets multiple cookie object. See Client.SetCookies for more information.
96+ // SetCookies sets multiple cookie object. See ` Client.SetCookies` for more information.
9697func SetCookies (cs []* http.Cookie ) * Client {
9798 return DefaultClient .SetCookies (cs )
9899}
99100
100- // SetQueryParam method sets single paramater and its value. See Client.SetQueryParam for more information.
101+ // SetQueryParam method sets single paramater and its value. See ` Client.SetQueryParam` for more information.
101102func SetQueryParam (param , value string ) * Client {
102103 return DefaultClient .SetQueryParam (param , value )
103104}
104105
105- // SetQueryParams method sets multiple paramaters and its value. See Client.SetQueryParams for more information.
106+ // SetQueryParams method sets multiple paramaters and its value. See ` Client.SetQueryParams` for more information.
106107func SetQueryParams (params map [string ]string ) * Client {
107108 return DefaultClient .SetQueryParams (params )
108109}
109110
110- // SetFormData method sets Form parameters and its values. See Client.SetFormData for more information.
111+ // SetFormData method sets Form parameters and its values. See ` Client.SetFormData` for more information.
111112func SetFormData (data map [string ]string ) * Client {
112113 return DefaultClient .SetFormData (data )
113114}
114115
115- // SetBasicAuth method sets the basic authentication header. See Client.SetBasicAuth for more information.
116+ // SetBasicAuth method sets the basic authentication header. See ` Client.SetBasicAuth` for more information.
116117func SetBasicAuth (username , password string ) * Client {
117118 return DefaultClient .SetBasicAuth (username , password )
118119}
119120
120- // SetAuthToken method sets bearer auth token header. See Client.SetAuthToken for more information.
121+ // SetAuthToken method sets bearer auth token header. See ` Client.SetAuthToken` for more information.
121122func SetAuthToken (token string ) * Client {
122123 return DefaultClient .SetAuthToken (token )
123124}
124125
125- // OnBeforeRequest method sets request middleware. See Client.OnBeforeRequest for more information.
126+ // OnBeforeRequest method sets request middleware. See ` Client.OnBeforeRequest` for more information.
126127func OnBeforeRequest (m func (* Client , * Request ) error ) * Client {
127128 return DefaultClient .OnBeforeRequest (m )
128129}
129130
130- // OnAfterResponse method sets response middleware. See Client.OnAfterResponse for more information.
131+ // OnAfterResponse method sets response middleware. See ` Client.OnAfterResponse` for more information.
131132func OnAfterResponse (m func (* Client , * Response ) error ) * Client {
132133 return DefaultClient .OnAfterResponse (m )
133134}
134135
135- // SetDebug method enables the debug mode. See Client.SetDebug for more information.
136+ // SetDebug method enables the debug mode. See ` Client.SetDebug` for more information.
136137func SetDebug (d bool ) * Client {
137138 return DefaultClient .SetDebug (d )
138139}
139140
140- // SetLogger method sets given writer for logging. See Client.SetLogger for more information.
141+ // SetLogger method sets given writer for logging. See ` Client.SetLogger` for more information.
141142func SetLogger (w io.Writer ) * Client {
142143 return DefaultClient .SetLogger (w )
143144}
144145
145- // SetContentLength method enables `Content-Length` value. See Client.SetContentLength for more information.
146+ // SetContentLength method enables `Content-Length` value. See ` Client.SetContentLength` for more information.
146147func SetContentLength (l bool ) * Client {
147148 return DefaultClient .SetContentLength (l )
148149}
149150
150- // SetError method is to register the global or client common `Error` object. See Client.SetError for more information.
151+ // SetError method is to register the global or client common `Error` object. See ` Client.SetError` for more information.
151152func SetError (err interface {}) * Client {
152153 return DefaultClient .SetError (err )
153154}
154155
155- // SetRedirectPolicy method sets the client redirect poilicy. See Client.SetRedirectPolicy for more information.
156+ // SetRedirectPolicy method sets the client redirect poilicy. See ` Client.SetRedirectPolicy` for more information.
156157func SetRedirectPolicy (policies ... interface {}) * Client {
157158 return DefaultClient .SetRedirectPolicy (policies ... )
158159}
159160
160- // SetHTTPMode method sets go-resty mode into HTTP. See Client.SetMode for more information.
161+ // SetHTTPMode method sets go-resty mode into HTTP. See ` Client.SetMode` for more information.
161162func SetHTTPMode () * Client {
162163 return DefaultClient .SetHTTPMode ()
163164}
164165
165- // SetRESTMode method sets go-resty mode into RESTful. See Client.SetMode for more information.
166+ // SetRESTMode method sets go-resty mode into RESTful. See ` Client.SetMode` for more information.
166167func SetRESTMode () * Client {
167168 return DefaultClient .SetRESTMode ()
168169}
169170
170- // Mode method returns the current client mode. See Client.Mode for more information.
171+ // Mode method returns the current client mode. See ` Client.Mode` for more information.
171172func Mode () string {
172173 return DefaultClient .Mode ()
173174}
174175
175- // SetTLSClientConfig method sets TLSClientConfig for underling client Transport. See Client.SetTLSClientConfig for more information.
176+ // SetTLSClientConfig method sets TLSClientConfig for underling client Transport. See ` Client.SetTLSClientConfig` for more information.
176177func SetTLSClientConfig (config * tls.Config ) * Client {
177178 return DefaultClient .SetTLSClientConfig (config )
178179}
179180
180- // SetTimeout method sets timeout for request. See Client.SetTimeout for more information.
181+ // SetTimeout method sets timeout for request. See ` Client.SetTimeout` for more information.
181182func SetTimeout (timeout time.Duration ) * Client {
182183 return DefaultClient .SetTimeout (timeout )
183184}
184185
185- // SetProxy method sets Proxy for request. See Client.SetProxy for more information.
186+ // SetProxy method sets Proxy for request. See ` Client.SetProxy` for more information.
186187func SetProxy (proxyURL string ) * Client {
187188 return DefaultClient .SetProxy (proxyURL )
188189}
189190
190- // RemoveProxy method removes the proxy configuration. See Client.RemoveProxy for more information.
191+ // RemoveProxy method removes the proxy configuration. See ` Client.RemoveProxy` for more information.
191192func RemoveProxy () * Client {
192193 return DefaultClient .RemoveProxy ()
193194}
0 commit comments