Client struct is used to create Resty client with client level settings,
these settings are applicable to all the request raised from the client.
Resty also provides an options to override most of the client settings
at request level.AllowGetMethodPayloadboolAuthSchemestringBaseURLstringCookies[]*http.CookieDebugboolDisableWarnboolErrorreflect.TypeFormDataurl.ValuesHeaderhttp.Header HeaderAuthorizationKey is used to set/access Request Authorization header
value when `SetAuthToken` option is used. // Deprecated: use BaseURL instead. To be removed in v3.0.0 release.JSONMarshalfunc(v interface{}) ([]byte, error)JSONUnmarshalfunc(data []byte, v interface{}) errorPathParamsmap[string]stringQueryParamurl.ValuesRawPathParamsmap[string]stringRetryAfterRetryAfterFuncRetryConditions[]RetryConditionFuncRetryCountintRetryHooks[]OnRetryFuncRetryMaxWaitTimetime.DurationRetryResetReadersboolRetryWaitTimetime.DurationTokenstringUserInfo*UserXMLMarshalfunc(v interface{}) ([]byte, error)XMLUnmarshalfunc(data []byte, v interface{}) error AddRetryAfterErrorCondition adds the basic condition of retrying after encountering
an error from the http response
Since v2.6.0 AddRetryCondition method adds a retry condition function to array of functions
that are checked to determine if the request is retried. The request will
retry if any of the functions return true and error is nil.
Note: These retry conditions are applied on all Request made using this Client.
For Request specific retry conditions check *Request.AddRetryCondition AddRetryHook adds a side-effecting retry hook to an array of hooks
that will be executed on each retry.
Since v2.6.0 DisableTrace method disables the Resty client trace. Refer to `Client.EnableTrace`.
Since v2.0.0 EnableTrace method enables the Resty client trace for the requests fired from
the client using `httptrace.ClientTrace` and provides insights.
client := resty.New().EnableTrace()
resp, err := client.R().Get("https://httpbin.org/get")
fmt.Println("Error:", err)
fmt.Println("Trace Info:", resp.Request.TraceInfo())
Also `Request.EnableTrace` available too to get trace info for single request.
Since v2.0.0 GetClient method returns the current `http.Client` used by the resty client. IsProxySet method returns the true is proxy is set from resty client otherwise
false. By default proxy is set from environment, refer to `http.ProxyFromEnvironment`. NewRequest is an alias for method `R()`. Creates a new request instance, its used for
Get, Post, Put, Delete, Patch, Head, Options, etc. OnAfterResponse method appends response middleware into the after response chain.
Once we receive response from host server, default Resty response middleware
gets applied and then user assigned response middlewares applied.
client.OnAfterResponse(func(c *resty.Client, r *resty.Response) error {
// Now you have access to Client and Response instance
// manipulate it as per your need
return nil // if its success otherwise return error
}) OnBeforeRequest method appends a request middleware into the before request chain.
The user defined middlewares get applied before the default Resty request middlewares.
After all middlewares have been applied, the request is sent from Resty to the host server.
client.OnBeforeRequest(func(c *resty.Client, r *resty.Request) error {
// Now you have access to Client and Request instance
// manipulate it as per your need
return nil // if its success otherwise return error
}) OnError method adds a callback that will be run whenever a request execution fails.
This is called after all retries have been attempted (if any).
If there was a response from the server, the error will be wrapped in *ResponseError
which has the last response received from the server.
client.OnError(func(req *resty.Request, err error) {
if v, ok := err.(*resty.ResponseError); ok {
// Do something with v.Response
}
// Log the error, increment a metric, etc...
})
Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one
set will be invoked for each call to Request.Execute() that completes. OnInvalid method adds a callback that will be run whenever a request execution
fails before it starts because the request is invalid.
Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one
set will be invoked for each call to Request.Execute() that completes.
Since v2.8.0 OnPanic method adds a callback that will be run whenever a request execution
panics.
Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one
set will be invoked for each call to Request.Execute() that completes.
If an OnSuccess, OnError, or OnInvalid callback panics, then the exactly
one rule can be violated.
Since v2.8.0 OnRequestLog method used to set request log callback into Resty. Registered callback gets
called before the resty actually logs the information. OnResponseLog method used to set response log callback into Resty. Registered callback gets
called before the resty actually logs the information. OnSuccess method adds a callback that will be run whenever a request execution
succeeds. This is called after all retries have been attempted (if any).
Out of the OnSuccess, OnError, OnInvalid, OnPanic callbacks, exactly one
set will be invoked for each call to Request.Execute() that completes.
Since v2.8.0 R method creates a new request instance, its used for Get, Post, Put, Delete, Patch, Head, Options, etc. RemoveProxy method removes the proxy configuration from Resty client
client.RemoveProxy() SetAllowGetMethodPayload method allows the GET method with payload on Resty client.
For Example: Resty allows the user sends request with a payload on HTTP GET method.
client.SetAllowGetMethodPayload(true) SetAuthScheme method sets the auth scheme type in the HTTP request. For Example:
Authorization: <auth-scheme-value> <auth-token-value>
For Example: To set the scheme to use OAuth
client.SetAuthScheme("OAuth")
This auth scheme gets added to all the requests raised from this client instance.
Also it can be overridden or set one at the request level is supported.
Information about auth schemes can be found in RFC7235 which is linked to below
along with the page containing the currently defined official authentication schemes:
https://tools.ietf.org/html/rfc7235
https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes
See `Request.SetAuthToken`. SetAuthToken method sets the auth token of the `Authorization` header for all HTTP requests.
The default auth scheme is `Bearer`, it can be customized with the method `SetAuthScheme`. For Example:
Authorization: <auth-scheme> <auth-token-value>
For Example: To set auth token BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F
client.SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F")
This auth token gets added to all the requests raised from this client instance.
Also it can be overridden or set one at the request level is supported.
See `Request.SetAuthToken`. SetBaseURL method is to set Base URL in the client instance. It will be used with request
raised from this client with relative URL
// Setting HTTP address
client.SetBaseURL("http://myjeeva.com")
// Setting HTTPS address
client.SetBaseURL("https://myjeeva.com")
Since v2.7.0 SetBasicAuth method sets the basic authentication header in the HTTP request. For Example:
Authorization: Basic <base64-encoded-value>
For Example: To set the header for username "go-resty" and password "welcome"
client.SetBasicAuth("go-resty", "welcome")
This basic auth information gets added to all the request raised from this client instance.
Also it can be overridden or set one at the request level is supported.
See `Request.SetBasicAuth`. SetCertificates method helps to set client certificates into Resty conveniently. SetCloseConnection method sets variable `Close` in http request struct with the given
value. More info: https://golang.org/src/net/http/request.go SetContentLength method enables the HTTP header `Content-Length` value for every request.
By default Resty won't set `Content-Length`.
client.SetContentLength(true)
Also you have an option to enable for particular request. See `Request.SetContentLength` SetCookie method appends a single cookie in the client instance.
These cookies will be added to all the request raised from this client instance.
client.SetCookie(&http.Cookie{
Name:"go-resty",
Value:"This is cookie value",
}) SetCookieJar method sets custom http.CookieJar in the resty client. Its way to override default.
For Example: sometimes we don't want to save cookies in api contacting, we can remove the default
CookieJar in resty client.
client.SetCookieJar(nil) SetCookies method sets an array of cookies in the client instance.
These cookies will be added to all the request raised from this client instance.
cookies := []*http.Cookie{
&http.Cookie{
Name:"go-resty-1",
Value:"This is cookie 1 value",
},
&http.Cookie{
Name:"go-resty-2",
Value:"This is cookie 2 value",
},
}
// Setting a cookies into resty
client.SetCookies(cookies) SetDebug method enables the debug mode on Resty client. Client logs details of every request and response.
For `Request` it logs information such as HTTP verb, Relative URL path, Host, Headers, Body if it has one.
For `Response` it logs information such as Status, Response Time, Headers, Body if it has one.
client.SetDebug(true)
Also it can be enabled at request level for particular request, see `Request.SetDebug`. SetDebugBodyLimit sets the maximum size for which the response and request body will be logged in debug mode.
client.SetDebugBodyLimit(1000000) SetDigestAuth method sets the Digest Access auth scheme for the client. If a server responds with 401 and sends
a Digest challenge in the WWW-Authenticate Header, requests will be resent with the appropriate Authorization Header.
For Example: To set the Digest scheme with user "Mufasa" and password "Circle Of Life"
client.SetDigestAuth("Mufasa", "Circle Of Life")
Information about Digest Access Authentication can be found in RFC7616:
https://datatracker.ietf.org/doc/html/rfc7616
See `Request.SetDigestAuth`. SetDisableWarn method disables the warning message on Resty client.
For Example: Resty warns the user when BasicAuth used on non-TLS mode.
client.SetDisableWarn(true) SetDoNotParseResponse method instructs `Resty` not to parse the response body automatically.
Resty exposes the raw response body as `io.ReadCloser`. Also do not forget to close the body,
otherwise you might get into connection leaks, no connection reuse.
Note: Response middlewares are not applicable, if you use this option. Basically you have
taken over the control of response parsing from `Resty`. SetError method is to register the global or client common `Error` object into Resty.
It is used for automatic unmarshalling if response status code is greater than 399 and
content type either JSON or XML. Can be pointer or non-pointer.
client.SetError(&Error{})
// OR
client.SetError(Error{}) SetFormData method sets Form parameters and their values in the client instance.
It's applicable only HTTP method `POST` and `PUT` and request content type would be set as
`application/x-www-form-urlencoded`. These form data will be added to all the request raised from
this client instance. Also it can be overridden at request level form data.
See `Request.SetFormData`.
client.SetFormData(map[string]string{
"access_token": "BC594900-518B-4F7E-AC75-BD37F019E08F",
"user_id": "3455454545",
}) SetHeader method sets a single header field and its value in the client instance.
These headers will be applied to all requests raised from this client instance.
Also it can be overridden at request level header options.
See `Request.SetHeader` or `Request.SetHeaders`.
For Example: To set `Content-Type` and `Accept` as `application/json`
client.
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json") SetHeaderVerbatim method is to set a single header field and its value verbatim in the current request.
For Example: To set `all_lowercase` and `UPPERCASE` as `available`.
client.R().
SetHeaderVerbatim("all_lowercase", "available").
SetHeaderVerbatim("UPPERCASE", "available")
Also you can override header value, which was set at client instance level.
Since v2.6.0 SetHeaders method sets multiple headers field and its values at one go in the client instance.
These headers will be applied to all requests raised from this client instance. Also it can be
overridden at request level headers options.
See `Request.SetHeaders` or `Request.SetHeader`.
For Example: To set `Content-Type` and `Accept` as `application/json`
client.SetHeaders(map[string]string{
"Content-Type": "application/json",
"Accept": "application/json",
}) SetHostURL method is to set Host URL in the client instance. It will be used with request
raised from this client with relative URL
// Setting HTTP address
client.SetHostURL("http://myjeeva.com")
// Setting HTTPS address
client.SetHostURL("https://myjeeva.com")
Deprecated: use SetBaseURL instead. To be removed in v3.0.0 release. SetJSONEscapeHTML method is to enable/disable the HTML escape on JSON marshal.
Note: This option only applicable to standard JSON Marshaller. SetJSONMarshaler method sets the JSON marshaler function to marshal the request body.
By default, Resty uses `encoding/json` package to marshal the request body.
Since v2.8.0 SetJSONUnmarshaler method sets the JSON unmarshaler function to unmarshal the response body.
By default, Resty uses `encoding/json` package to unmarshal the response body.
Since v2.8.0 SetLogger method sets given writer for logging Resty request and response details.
Compliant to interface `resty.Logger`. SetOutputDirectory method sets output directory for saving HTTP response into file.
If the output directory not exists then resty creates one. This setting is optional one,
if you're planning using absolute path in `Request.SetOutput` and can used together.
client.SetOutputDirectory("/save/http/response/here") SetPathParam method sets single URL path key-value pair in the
Resty client instance.
client.SetPathParam("userId", "sample@sample.com")
Result:
URL - /v1/users/{userId}/details
Composed URL - /v1/users/sample@sample.com/details
It replaces the value of the key while composing the request URL.
The value will be escaped using `url.PathEscape` function.
Also it can be overridden at request level Path Params options,
see `Request.SetPathParam` or `Request.SetPathParams`. SetPathParams method sets multiple URL path key-value pairs at one go in the
Resty client instance.
client.SetPathParams(map[string]string{
"userId": "sample@sample.com",
"subAccountId": "100002",
"path": "groups/developers",
})
Result:
URL - /v1/users/{userId}/{subAccountId}/{path}/details
Composed URL - /v1/users/sample@sample.com/100002/groups%2Fdevelopers/details
It replaces the value of the key while composing the request URL.
The values will be escaped using `url.PathEscape` function.
Also it can be overridden at request level Path Params options,
see `Request.SetPathParam` or `Request.SetPathParams`. SetPreRequestHook method sets the given pre-request function into resty client.
It is called right before the request is fired.
Note: Only one pre-request hook can be registered. Use `client.OnBeforeRequest` for multiple. SetProxy method sets the Proxy URL and Port for Resty client.
client.SetProxy("http://proxyserver:8888")
OR Without this `SetProxy` method, you could also set Proxy via environment variable.
Refer to godoc `http.ProxyFromEnvironment`. SetQueryParam method sets single parameter and its value in the client instance.
It will be formed as query string for the request.
For Example: `search=kitchen%20papers&size=large`
in the URL after `?` mark. These query params will be added to all the request raised from
this client instance. Also it can be overridden at request level Query Param options.
See `Request.SetQueryParam` or `Request.SetQueryParams`.
client.
SetQueryParam("search", "kitchen papers").
SetQueryParam("size", "large") SetQueryParams method sets multiple parameters and their values at one go in the client instance.
It will be formed as query string for the request.
For Example: `search=kitchen%20papers&size=large`
in the URL after `?` mark. These query params will be added to all the request raised from this
client instance. Also it can be overridden at request level Query Param options.
See `Request.SetQueryParams` or `Request.SetQueryParam`.
client.SetQueryParams(map[string]string{
"search": "kitchen papers",
"size": "large",
}) SetRateLimiter sets an optional `RateLimiter`. If set the rate limiter will control
all requests made with this client.
Since v2.9.0 SetRawPathParam method sets single URL path key-value pair in the
Resty client instance.
client.SetPathParam("userId", "sample@sample.com")
Result:
URL - /v1/users/{userId}/details
Composed URL - /v1/users/sample@sample.com/details
client.SetPathParam("path", "groups/developers")
Result:
URL - /v1/users/{userId}/details
Composed URL - /v1/users/groups%2Fdevelopers/details
It replaces the value of the key while composing the request URL.
The value will be used as it is and will not be escaped.
Also it can be overridden at request level Path Params options,
see `Request.SetPathParam` or `Request.SetPathParams`.
Since v2.8.0 SetRawPathParams method sets multiple URL path key-value pairs at one go in the
Resty client instance.
client.SetPathParams(map[string]string{
"userId": "sample@sample.com",
"subAccountId": "100002",
"path": "groups/developers",
})
Result:
URL - /v1/users/{userId}/{subAccountId}/{path}/details
Composed URL - /v1/users/sample@sample.com/100002/groups/developers/details
It replaces the value of the key while composing the request URL.
The values will be used as they are and will not be escaped.
Also it can be overridden at request level Path Params options,
see `Request.SetPathParam` or `Request.SetPathParams`.
Since v2.8.0 SetRedirectPolicy method sets the client redirect policy. Resty provides ready to use
redirect policies. Wanna create one for yourself refer to `redirect.go`.
client.SetRedirectPolicy(FlexibleRedirectPolicy(20))
// Need multiple redirect policies together
client.SetRedirectPolicy(FlexibleRedirectPolicy(20), DomainCheckRedirectPolicy("host1.com", "host2.net")) SetRetryAfter sets callback to calculate wait time between retries.
Default (nil) implies exponential backoff with jitter SetRetryCount method enables retry on Resty client and allows you
to set no. of retry count. Resty uses a Backoff mechanism. SetRetryMaxWaitTime method sets max wait time to sleep before retrying
request.
Default is 2 seconds. SetRetryResetReaders method enables the Resty client to seek the start of all
file readers given as multipart files, if the given object implements `io.ReadSeeker`.
Since ... SetRetryWaitTime method sets default wait time to sleep before retrying
request.
Default is 100 milliseconds. SetRootCertificate method helps to add one or more root certificates into Resty client
client.SetRootCertificate("/path/to/root/pemFile.pem") SetRootCertificateFromString method helps to add one or more root certificates into Resty client
client.SetRootCertificateFromString("pem file content") SetScheme method sets custom scheme in the Resty client. It's way to override default.
client.SetScheme("http") SetTLSClientConfig method sets TLSClientConfig for underling client Transport.
For Example:
// One can set custom root-certificate. Refer: http://golang.org/pkg/crypto/tls/#example_Dial
client.SetTLSClientConfig(&tls.Config{ RootCAs: roots })
// or One can disable security check (https)
client.SetTLSClientConfig(&tls.Config{ InsecureSkipVerify: true })
Note: This method overwrites existing `TLSClientConfig`. SetTimeout method sets timeout for request raised from client.
client.SetTimeout(time.Duration(1 * time.Minute)) SetTransport method sets custom `*http.Transport` or any `http.RoundTripper`
compatible interface implementation in the resty client.
Note:
- If transport is not type of `*http.Transport` then you may not be able to
take advantage of some of the Resty client settings.
- It overwrites the Resty client transport instance and it's configurations.
transport := &http.Transport{
// something like Proxying to httptest.Server, etc...
Proxy: func(req *http.Request) (*url.URL, error) {
return url.Parse(server.URL)
},
}
client.SetTransport(transport) SetXMLMarshaler method sets the XML marshaler function to marshal the request body.
By default, Resty uses `encoding/xml` package to marshal the request body.
Since v2.8.0 SetXMLUnmarshaler method sets the XML unmarshaler function to unmarshal the response body.
By default, Resty uses `encoding/xml` package to unmarshal the response body.
Since v2.8.0 Transport method returns `*http.Transport` currently in use or error
in case currently used `transport` is not a `*http.Transport`.
Since v2.8.0 become exported method.
func New() *Client
func NewWithClient(hc *http.Client) *Client
func NewWithLocalAddr(localAddr net.Addr) *Client
func (*Client).AddRetryAfterErrorCondition() *Client
func (*Client).AddRetryCondition(condition RetryConditionFunc) *Client
func (*Client).AddRetryHook(hook OnRetryFunc) *Client
func (*Client).DisableTrace() *Client
func (*Client).EnableTrace() *Client
func (*Client).OnAfterResponse(m ResponseMiddleware) *Client
func (*Client).OnBeforeRequest(m RequestMiddleware) *Client
func (*Client).OnError(h ErrorHook) *Client
func (*Client).OnInvalid(h ErrorHook) *Client
func (*Client).OnPanic(h ErrorHook) *Client
func (*Client).OnRequestLog(rl RequestLogCallback) *Client
func (*Client).OnResponseLog(rl ResponseLogCallback) *Client
func (*Client).OnSuccess(h SuccessHook) *Client
func (*Client).RemoveProxy() *Client
func (*Client).SetAllowGetMethodPayload(a bool) *Client
func (*Client).SetAuthScheme(scheme string) *Client
func (*Client).SetAuthToken(token string) *Client
func (*Client).SetBaseURL(url string) *Client
func (*Client).SetBasicAuth(username, password string) *Client
func (*Client).SetCertificates(certs ...tls.Certificate) *Client
func (*Client).SetCloseConnection(close bool) *Client
func (*Client).SetContentLength(l bool) *Client
func (*Client).SetCookie(hc *http.Cookie) *Client
func (*Client).SetCookieJar(jar http.CookieJar) *Client
func (*Client).SetCookies(cs []*http.Cookie) *Client
func (*Client).SetDebug(d bool) *Client
func (*Client).SetDebugBodyLimit(sl int64) *Client
func (*Client).SetDigestAuth(username, password string) *Client
func (*Client).SetDisableWarn(d bool) *Client
func (*Client).SetDoNotParseResponse(parse bool) *Client
func (*Client).SetError(err interface{}) *Client
func (*Client).SetFormData(data map[string]string) *Client
func (*Client).SetHeader(header, value string) *Client
func (*Client).SetHeaders(headers map[string]string) *Client
func (*Client).SetHeaderVerbatim(header, value string) *Client
func (*Client).SetHostURL(url string) *Client
func (*Client).SetJSONEscapeHTML(b bool) *Client
func (*Client).SetJSONMarshaler(marshaler func(v interface{}) ([]byte, error)) *Client
func (*Client).SetJSONUnmarshaler(unmarshaler func(data []byte, v interface{}) error) *Client
func (*Client).SetLogger(l Logger) *Client
func (*Client).SetOutputDirectory(dirPath string) *Client
func (*Client).SetPathParam(param, value string) *Client
func (*Client).SetPathParams(params map[string]string) *Client
func (*Client).SetPreRequestHook(h PreRequestHook) *Client
func (*Client).SetProxy(proxyURL string) *Client
func (*Client).SetQueryParam(param, value string) *Client
func (*Client).SetQueryParams(params map[string]string) *Client
func (*Client).SetRateLimiter(rl RateLimiter) *Client
func (*Client).SetRawPathParam(param, value string) *Client
func (*Client).SetRawPathParams(params map[string]string) *Client
func (*Client).SetRedirectPolicy(policies ...interface{}) *Client
func (*Client).SetRetryAfter(callback RetryAfterFunc) *Client
func (*Client).SetRetryCount(count int) *Client
func (*Client).SetRetryMaxWaitTime(maxWaitTime time.Duration) *Client
func (*Client).SetRetryResetReaders(b bool) *Client
func (*Client).SetRetryWaitTime(waitTime time.Duration) *Client
func (*Client).SetRootCertificate(pemFilePath string) *Client
func (*Client).SetRootCertificateFromString(pemContent string) *Client
func (*Client).SetScheme(scheme string) *Client
func (*Client).SetTimeout(timeout time.Duration) *Client
func (*Client).SetTLSClientConfig(config *tls.Config) *Client
func (*Client).SetTransport(transport http.RoundTripper) *Client
func (*Client).SetXMLMarshaler(marshaler func(v interface{}) ([]byte, error)) *Client
func (*Client).SetXMLUnmarshaler(unmarshaler func(data []byte, v interface{}) error) *Client
func github.com/Nerzal/gocloak/v13.(*GoCloak).RestyClient() *Client
func Unmarshalc(c *Client, ct string, b []byte, d interface{}) (err error)
func github.com/Nerzal/gocloak/v13.(*GoCloak).SetRestyClient(restyClient *Client)
Logger interface is to abstract the logging from Resty. Gives control to
the Resty users, choice of the logger.( Logger) Debugf(format string, v ...interface{})( Logger) Errorf(format string, v ...interface{})( Logger) Warnf(format string, v ...interface{})
github.com/gofiber/fiber/v2/log.AllLogger(interface)
github.com/gofiber/fiber/v2/log.CommonLogger(interface)
github.com/gofiber/fiber/v2/log.FormatLogger(interface)
*go.uber.org/zap.SugaredLogger
func (*Client).SetLogger(l Logger) *Client
func (*Request).SetLogger(l Logger) *Request
RedirectPolicy to regulate the redirects in the resty client.
Objects implementing the RedirectPolicy interface can be registered as
Apply function should return nil to continue the redirect journey, otherwise
return error to stop the redirect.( RedirectPolicy) Apply(req *http.Request, via []*http.Request) errorRedirectPolicyFunc
func DomainCheckRedirectPolicy(hostnames ...string) RedirectPolicy
func FlexibleRedirectPolicy(noOfRedirect int) RedirectPolicy
func NoRedirectPolicy() RedirectPolicy
The RedirectPolicyFunc type is an adapter to allow the use of ordinary functions as RedirectPolicy.
If f is a function with the appropriate signature, RedirectPolicyFunc(f) is a RedirectPolicy object that calls f. Apply calls f(req, via).
RedirectPolicyFunc : RedirectPolicy
Request struct is used to compose and fire individual request from
resty client. Request provides an options to override client level
settings and also an options for the request composition. Attempt is to represent the request attempt made during a Resty
request execution flow, including retry count.
Since v2.4.0AuthSchemestringBodyinterface{}Cookies[]*http.CookieDebugboolErrorinterface{}FormDataurl.ValuesHeaderhttp.HeaderMethodstringPathParamsmap[string]stringQueryParamurl.ValuesRawPathParamsmap[string]stringRawRequest*http.RequestResultinterface{}SRV*SRVRecordTimetime.TimeTokenstringURLstringUserInfo*User AddRetryCondition method adds a retry condition function to the request's
array of functions that are checked to determine if the request is retried.
The request will retry if any of the functions return true and error is nil.
Note: These retry conditions are checked before all retry conditions of the client.
Since v2.7.0 Context method returns the Context if its already set in request
otherwise it creates new one using `context.Background()`. Delete method does DELETE HTTP request. It's defined in section 4.3.5 of RFC7231. EnableTrace method enables trace for the current request
using `httptrace.ClientTrace` and provides insights.
client := resty.New()
resp, err := client.R().EnableTrace().Get("https://httpbin.org/get")
fmt.Println("Error:", err)
fmt.Println("Trace Info:", resp.Request.TraceInfo())
See `Client.EnableTrace` available too to get trace info for all requests.
Since v2.0.0 Execute method performs the HTTP request with given HTTP method and URL
for current `Request`.
resp, err := client.R().Execute(resty.GET, "http://httpbin.org/get") ExpectContentType method allows to provide fallback `Content-Type` for automatic unmarshalling
when `Content-Type` response header is unavailable. ForceContentType method provides a strong sense of response `Content-Type` for automatic unmarshalling.
Resty gives this a higher priority than the `Content-Type` response header. This means that if both
`Request.ForceContentType` is set and the response `Content-Type` is available, `ForceContentType` will win. Get method does GET HTTP request. It's defined in section 4.3.1 of RFC7231. Head method does HEAD HTTP request. It's defined in section 4.3.2 of RFC7231. Options method does OPTIONS HTTP request. It's defined in section 4.3.7 of RFC7231. Patch method does PATCH HTTP request. It's defined in section 2 of RFC5789. Post method does POST HTTP request. It's defined in section 4.3.3 of RFC7231. Put method does PUT HTTP request. It's defined in section 4.3.4 of RFC7231. Send method performs the HTTP request using the method and URL already defined
for current `Request`.
req := client.R()
req.Method = resty.GET
req.URL = "http://httpbin.org/get"
resp, err := req.Send() SetAuthScheme method sets the auth token scheme type in the HTTP request. For Example:
Authorization: <auth-scheme-value-set-here> <auth-token-value>
For Example: To set the scheme to use OAuth
client.R().SetAuthScheme("OAuth")
This auth header scheme gets added to all the request raised from this client instance.
Also it can be overridden or set one at the request level is supported.
Information about Auth schemes can be found in RFC7235 which is linked to below along with the page containing
the currently defined official authentication schemes:
https://tools.ietf.org/html/rfc7235
https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes
This method overrides the Authorization scheme set by method `Client.SetAuthScheme`. SetAuthToken method sets the auth token header(Default Scheme: Bearer) in the current HTTP request. Header example:
Authorization: Bearer <auth-token-value-comes-here>
For Example: To set auth token BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F
client.R().SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F")
This method overrides the Auth token set by method `Client.SetAuthToken`. SetBasicAuth method sets the basic authentication header in the current HTTP request.
For Example:
Authorization: Basic <base64-encoded-value>
To set the header for username "go-resty" and password "welcome"
client.R().SetBasicAuth("go-resty", "welcome")
This method overrides the credentials set by method `Client.SetBasicAuth`. SetBody method sets the request body for the request. It supports various realtime needs as easy.
We can say its quite handy or powerful. Supported request body data types is `string`,
`[]byte`, `struct`, `map`, `slice` and `io.Reader`. Body value can be pointer or non-pointer.
Automatic marshalling for JSON and XML content type, if it is `struct`, `map`, or `slice`.
Note: `io.Reader` is processed as bufferless mode while sending request.
For Example: Struct as a body input, based on content type, it will be marshalled.
client.R().
SetBody(User{
Username: "jeeva@myjeeva.com",
Password: "welcome2resty",
})
Map as a body input, based on content type, it will be marshalled.
client.R().
SetBody(map[string]interface{}{
"username": "jeeva@myjeeva.com",
"password": "welcome2resty",
"address": &Address{
Address1: "1111 This is my street",
Address2: "Apt 201",
City: "My City",
State: "My State",
ZipCode: 00000,
},
})
String as a body input. Suitable for any need as a string input.
client.R().
SetBody(`{
"username": "jeeva@getrightcare.com",
"password": "admin"
}`)
[]byte as a body input. Suitable for raw request such as file upload, serialize & deserialize, etc.
client.R().
SetBody([]byte("This is my raw request, sent as-is")) SetContentLength method sets the HTTP header `Content-Length` value for current request.
By default Resty won't set `Content-Length`. Also you have an option to enable for every
request.
See `Client.SetContentLength`
client.R().SetContentLength(true) SetContext method sets the context.Context for current Request. It allows
to interrupt the request execution if ctx.Done() channel is closed.
See https://blog.golang.org/context article and the "context" package
documentation. SetCookie method appends a single cookie in the current request instance.
client.R().SetCookie(&http.Cookie{
Name:"go-resty",
Value:"This is cookie value",
})
Note: Method appends the Cookie value into existing Cookie if already existing.
Since v2.1.0 SetCookies method sets an array of cookies in the current request instance.
cookies := []*http.Cookie{
&http.Cookie{
Name:"go-resty-1",
Value:"This is cookie 1 value",
},
&http.Cookie{
Name:"go-resty-2",
Value:"This is cookie 2 value",
},
}
// Setting a cookies into resty's current request
client.R().SetCookies(cookies)
Note: Method appends the Cookie value into existing Cookie if already existing.
Since v2.1.0 SetDebug method enables the debug mode on current request Resty request, It logs
the details current request and response.
For `Request` it logs information such as HTTP verb, Relative URL path, Host, Headers, Body if it has one.
For `Response` it logs information such as Status, Response Time, Headers, Body if it has one.
client.R().SetDebug(true) SetDigestAuth method sets the Digest Access auth scheme for the HTTP request. If a server responds with 401 and sends
a Digest challenge in the WWW-Authenticate Header, the request will be resent with the appropriate Authorization Header.
For Example: To set the Digest scheme with username "Mufasa" and password "Circle Of Life"
client.R().SetDigestAuth("Mufasa", "Circle Of Life")
Information about Digest Access Authentication can be found in RFC7616:
https://datatracker.ietf.org/doc/html/rfc7616
This method overrides the username and password set by method `Client.SetDigestAuth`. SetDoNotParseResponse method instructs `Resty` not to parse the response body automatically.
Resty exposes the raw response body as `io.ReadCloser`. Also do not forget to close the body,
otherwise you might get into connection leaks, no connection reuse.
Note: Response middlewares are not applicable, if you use this option. Basically you have
taken over the control of response parsing from `Resty`. SetError method is to register the request `Error` object for automatic unmarshalling for the request,
if response status code is greater than 399 and content type either JSON or XML.
Note: Error object can be pointer or non-pointer.
client.R().SetError(&AuthError{})
// OR
client.R().SetError(AuthError{})
Accessing a error value from response instance.
response.Error().(*AuthError) SetFile method is to set single file field name and its path for multipart upload.
client.R().
SetFile("my_file", "/Users/jeeva/Gas Bill - Sep.pdf") SetFileReader method is to set single file using io.Reader for multipart upload.
client.R().
SetFileReader("profile_img", "my-profile-img.png", bytes.NewReader(profileImgBytes)).
SetFileReader("notes", "user-notes.txt", bytes.NewReader(notesBytes)) SetFiles method is to set multiple file field name and its path for multipart upload.
client.R().
SetFiles(map[string]string{
"my_file1": "/Users/jeeva/Gas Bill - Sep.pdf",
"my_file2": "/Users/jeeva/Electricity Bill - Sep.pdf",
"my_file3": "/Users/jeeva/Water Bill - Sep.pdf",
}) SetFormData method sets Form parameters and their values in the current request.
It's applicable only HTTP method `POST` and `PUT` and requests content type would be set as
`application/x-www-form-urlencoded`.
client.R().
SetFormData(map[string]string{
"access_token": "BC594900-518B-4F7E-AC75-BD37F019E08F",
"user_id": "3455454545",
})
Also you can override form data value, which was set at client instance level. SetFormDataFromValues method appends multiple form parameters with multi-value
(`url.Values`) at one go in the current request.
client.R().
SetFormDataFromValues(url.Values{
"search_criteria": []string{"book", "glass", "pencil"},
})
Also you can override form data value, which was set at client instance level. SetHeader method is to set a single header field and its value in the current request.
For Example: To set `Content-Type` and `Accept` as `application/json`.
client.R().
SetHeader("Content-Type", "application/json").
SetHeader("Accept", "application/json")
Also you can override header value, which was set at client instance level. SetHeaderMultiValues sets multiple headers fields and its values is list of strings at one go in the current request.
For Example: To set `Accept` as `text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8`
client.R().
SetHeaderMultiValues(map[string][]string{
"Accept": []string{"text/html", "application/xhtml+xml", "application/xml;q=0.9", "image/webp", "*/*;q=0.8"},
})
Also you can override header value, which was set at client instance level. SetHeaderVerbatim method is to set a single header field and its value verbatim in the current request.
For Example: To set `all_lowercase` and `UPPERCASE` as `available`.
client.R().
SetHeaderVerbatim("all_lowercase", "available").
SetHeaderVerbatim("UPPERCASE", "available")
Also you can override header value, which was set at client instance level.
Since v2.6.0 SetHeaders method sets multiple headers field and its values at one go in the current request.
For Example: To set `Content-Type` and `Accept` as `application/json`
client.R().
SetHeaders(map[string]string{
"Content-Type": "application/json",
"Accept": "application/json",
})
Also you can override header value, which was set at client instance level. SetJSONEscapeHTML method is to enable/disable the HTML escape on JSON marshal.
Note: This option only applicable to standard JSON Marshaller. SetLogger method sets given writer for logging Resty request and response details.
By default, requests and responses inherit their logger from the client.
Compliant to interface `resty.Logger`. SetMultipartField method is to set custom data using io.Reader for multipart upload. SetMultipartFields method is to set multiple data fields using io.Reader for multipart upload.
For Example:
client.R().SetMultipartFields(
&resty.MultipartField{
Param: "uploadManifest1",
FileName: "upload-file-1.json",
ContentType: "application/json",
Reader: strings.NewReader(`{"input": {"name": "Uploaded document 1", "_filename" : ["file1.txt"]}}`),
},
&resty.MultipartField{
Param: "uploadManifest2",
FileName: "upload-file-2.json",
ContentType: "application/json",
Reader: strings.NewReader(`{"input": {"name": "Uploaded document 2", "_filename" : ["file2.txt"]}}`),
})
If you have slice already, then simply call-
client.R().SetMultipartFields(fields...) SetMultipartFormData method allows simple form data to be attached to the request as `multipart:form-data` SetOutput method sets the output file for current HTTP request. Current HTTP response will be
saved into given file. It is similar to `curl -o` flag. Absolute path or relative path can be used.
If is it relative path then output file goes under the output directory, as mentioned
in the `Client.SetOutputDirectory`.
client.R().
SetOutput("/Users/jeeva/Downloads/ReplyWithHeader-v5.1-beta.zip").
Get("http://bit.ly/1LouEKr")
Note: In this scenario `Response.Body` might be nil. SetPathParam method sets single URL path key-value pair in the
Resty current request instance.
client.R().SetPathParam("userId", "sample@sample.com")
Result:
URL - /v1/users/{userId}/details
Composed URL - /v1/users/sample@sample.com/details
client.R().SetPathParam("path", "groups/developers")
Result:
URL - /v1/users/{userId}/details
Composed URL - /v1/users/groups%2Fdevelopers/details
It replaces the value of the key while composing the request URL.
The values will be escaped using `url.PathEscape` function.
Also you can override Path Params value, which was set at client instance
level. SetPathParams method sets multiple URL path key-value pairs at one go in the
Resty current request instance.
client.R().SetPathParams(map[string]string{
"userId": "sample@sample.com",
"subAccountId": "100002",
"path": "groups/developers",
})
Result:
URL - /v1/users/{userId}/{subAccountId}/{path}/details
Composed URL - /v1/users/sample@sample.com/100002/groups%2Fdevelopers/details
It replaces the value of the key while composing request URL.
The value will be used as it is and will not be escaped.
Also you can override Path Params value, which was set at client instance
level. SetQueryParam method sets single parameter and its value in the current request.
It will be formed as query string for the request.
For Example: `search=kitchen%20papers&size=large` in the URL after `?` mark.
client.R().
SetQueryParam("search", "kitchen papers").
SetQueryParam("size", "large")
Also you can override query params value, which was set at client instance level. SetQueryParams method sets multiple parameters and its values at one go in the current request.
It will be formed as query string for the request.
For Example: `search=kitchen%20papers&size=large` in the URL after `?` mark.
client.R().
SetQueryParams(map[string]string{
"search": "kitchen papers",
"size": "large",
})
Also you can override query params value, which was set at client instance level. SetQueryParamsFromValues method appends multiple parameters with multi-value
(`url.Values`) at one go in the current request. It will be formed as
query string for the request.
For Example: `status=pending&status=approved&status=open` in the URL after `?` mark.
client.R().
SetQueryParamsFromValues(url.Values{
"status": []string{"pending", "approved", "open"},
})
Also you can override query params value, which was set at client instance level. SetQueryString method provides ability to use string as an input to set URL query string for the request.
Using String as an input
client.R().
SetQueryString("productId=232&template=fresh-sample&cat=resty&source=google&kw=buy a lot more") SetRawPathParam method sets single URL path key-value pair in the
Resty current request instance.
client.R().SetPathParam("userId", "sample@sample.com")
Result:
URL - /v1/users/{userId}/details
Composed URL - /v1/users/sample@sample.com/details
client.R().SetPathParam("path", "groups/developers")
Result:
URL - /v1/users/{userId}/details
Composed URL - /v1/users/groups/developers/details
It replaces the value of the key while composing the request URL.
The value will be used as it is and will not be escaped.
Also you can override Path Params value, which was set at client instance
level.
Since v2.8.0 SetRawPathParams method sets multiple URL path key-value pairs at one go in the
Resty current request instance.
client.R().SetPathParams(map[string]string{
"userId": "sample@sample.com",
"subAccountId": "100002",
"path": "groups/developers",
})
Result:
URL - /v1/users/{userId}/{subAccountId}/{path}/details
Composed URL - /v1/users/sample@sample.com/100002/groups/developers/details
It replaces the value of the key while composing request URL.
The values will be used as they are and will not be escaped.
Also you can override Path Params value, which was set at client instance
level.
Since v2.8.0 SetResult method is to register the response `Result` object for automatic unmarshalling for the request,
if response status code is between 200 and 299 and content type either JSON or XML.
Note: Result object can be pointer or non-pointer.
client.R().SetResult(&AuthToken{})
// OR
client.R().SetResult(AuthToken{})
Accessing a result value from response instance.
response.Result().(*AuthToken) SetSRV method sets the details to query the service SRV record and execute the
request.
client.R().
SetSRV(SRVRecord{"web", "testservice.com"}).
Get("/get") TraceInfo method returns the trace info for the request.
If either the Client or Request EnableTrace function has not been called
prior to the request being made, an empty TraceInfo object will be returned.
Since v2.0.0
func (*Client).NewRequest() *Request
func (*Client).R() *Request
func (*Request).AddRetryCondition(condition RetryConditionFunc) *Request
func (*Request).EnableTrace() *Request
func (*Request).ExpectContentType(contentType string) *Request
func (*Request).ForceContentType(contentType string) *Request
func (*Request).SetAuthScheme(scheme string) *Request
func (*Request).SetAuthToken(token string) *Request
func (*Request).SetBasicAuth(username, password string) *Request
func (*Request).SetBody(body interface{}) *Request
func (*Request).SetContentLength(l bool) *Request
func (*Request).SetContext(ctx context.Context) *Request
func (*Request).SetCookie(hc *http.Cookie) *Request
func (*Request).SetCookies(rs []*http.Cookie) *Request
func (*Request).SetDebug(d bool) *Request
func (*Request).SetDigestAuth(username, password string) *Request
func (*Request).SetDoNotParseResponse(parse bool) *Request
func (*Request).SetError(err interface{}) *Request
func (*Request).SetFile(param, filePath string) *Request
func (*Request).SetFileReader(param, fileName string, reader io.Reader) *Request
func (*Request).SetFiles(files map[string]string) *Request
func (*Request).SetFormData(data map[string]string) *Request
func (*Request).SetFormDataFromValues(data url.Values) *Request
func (*Request).SetHeader(header, value string) *Request
func (*Request).SetHeaderMultiValues(headers map[string][]string) *Request
func (*Request).SetHeaders(headers map[string]string) *Request
func (*Request).SetHeaderVerbatim(header, value string) *Request
func (*Request).SetJSONEscapeHTML(b bool) *Request
func (*Request).SetLogger(l Logger) *Request
func (*Request).SetMultipartField(param, fileName, contentType string, reader io.Reader) *Request
func (*Request).SetMultipartFields(fields ...*MultipartField) *Request
func (*Request).SetMultipartFormData(data map[string]string) *Request
func (*Request).SetOutput(file string) *Request
func (*Request).SetPathParam(param, value string) *Request
func (*Request).SetPathParams(params map[string]string) *Request
func (*Request).SetQueryParam(param, value string) *Request
func (*Request).SetQueryParams(params map[string]string) *Request
func (*Request).SetQueryParamsFromValues(params url.Values) *Request
func (*Request).SetQueryString(query string) *Request
func (*Request).SetRawPathParam(param, value string) *Request
func (*Request).SetRawPathParams(params map[string]string) *Request
func (*Request).SetResult(res interface{}) *Request
func (*Request).SetSRV(srv *SRVRecord) *Request
func github.com/Nerzal/gocloak/v13.(*GoCloak).GetRequest(ctx context.Context) *Request
func github.com/Nerzal/gocloak/v13.(*GoCloak).GetRequestWithBasicAuth(ctx context.Context, clientID, clientSecret string) *Request
func github.com/Nerzal/gocloak/v13.(*GoCloak).GetRequestWithBearerAuth(ctx context.Context, token string) *Request
func github.com/Nerzal/gocloak/v13.(*GoCloak).GetRequestWithBearerAuthNoCache(ctx context.Context, token string) *Request
func github.com/Nerzal/gocloak/v13.(*GoCloak).GetRequestWithBearerAuthXMLHeader(ctx context.Context, token string) *Request
RequestLog struct is used to collected information from resty request
instance for debug logging. It sent to request log callback before resty
actually logs the information.BodystringHeaderhttp.Header
RequestLogCallback type is for request logs, called before the request is logged
func (*Client).OnRequestLog(rl RequestLogCallback) *Client
RequestMiddleware type is for request middleware, called before a request is sent
func (*Client).OnBeforeRequest(m RequestMiddleware) *Client
Response struct holds response values of executed request.RawResponse*http.ResponseRequest*Request Body method returns HTTP response as []byte array for the executed request.
Note: `Response.Body` might be nil, if `Request.SetOutput` is used. Cookies method to access all the response cookies Error method returns the error object if it has one Header method returns the response headers IsError method returns true if HTTP status `code >= 400` otherwise false. IsSuccess method returns true if HTTP status `code >= 200 and <= 299` otherwise false. Proto method returns the HTTP response protocol used for the request. RawBody method exposes the HTTP raw response body. Use this method in-conjunction with `SetDoNotParseResponse`
option otherwise you get an error as `read err: http: read on closed response body`.
Do not forget to close the body, otherwise you might get into connection leaks, no connection reuse.
Basically you have taken over the control of response parsing from `Resty`. ReceivedAt method returns when response got received from server for the request. Result method returns the response value as an object if it has one SetBody method is to set Response body in byte slice. Typically,
its helpful for test cases.
resp.SetBody([]byte("This is test body content"))
resp.SetBody(nil)
Since v2.10.0 Size method returns the HTTP response size in bytes. Ya, you can relay on HTTP `Content-Length` header,
however it won't be good for chucked transfer/compressed response. Since Resty calculates response size
at the client end. You will get actual size of the http response. Status method returns the HTTP status string for the executed request.
Example: 200 OK StatusCode method returns the HTTP status code for the executed request.
Example: 200 String method returns the body of the server response as String. Time method returns the time of HTTP response time that from request we sent and received a request.
See `Response.ReceivedAt` to know when client received response and see `Response.Request.Time` to know
when client sent a request.
*Response : github.com/ChrisTrenkamp/goxpath/tree.Result
*Response : fmt.Stringer
func (*Request).Delete(url string) (*Response, error)
func (*Request).Execute(method, url string) (*Response, error)
func (*Request).Get(url string) (*Response, error)
func (*Request).Head(url string) (*Response, error)
func (*Request).Options(url string) (*Response, error)
func (*Request).Patch(url string) (*Response, error)
func (*Request).Post(url string) (*Response, error)
func (*Request).Put(url string) (*Response, error)
func (*Request).Send() (*Response, error)
func (*Response).SetBody(b []byte) *Response
ResponseError is a wrapper for including the server response with an error.
Neither the err nor the response should be nil.ErrerrorResponse*Response(*ResponseError) Error() string(*ResponseError) Unwrap() error
*ResponseError : error
ResponseLog struct is used to collected information from resty response
instance for debug logging. It sent to response log callback before resty
actually logs the information.BodystringHeaderhttp.Header
ResponseLogCallback type is for response logs, called before the response is logged
func (*Client).OnResponseLog(rl ResponseLogCallback) *Client
ResponseMiddleware type is for response middleware, called after a response has been received
func (*Client).OnAfterResponse(m ResponseMiddleware) *Client
RetryAfterFunc returns time to wait before retry
For example, it can parse HTTP Retry-After header
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
Non-nil error is returned if it is found that request is not retryable
(0, nil) is a special result means 'use default algorithm'
func (*Client).SetRetryAfter(callback RetryAfterFunc) *Client
SuccessHook type is for reacting to request success
func (*Client).OnSuccess(h SuccessHook) *Client
TraceInfo struct is used provide request trace info such as DNS lookup
duration, Connection obtain duration, Server processing duration, etc.
Since v2.0.0 ConnIdleTime is a duration how long the connection was previously
idle, if IsConnWasIdle is true. ConnTime is a duration that took to obtain a successful connection. DNSLookup is a duration that transport took to perform
DNS lookup. IsConnReused is whether this connection has been previously
used for another HTTP request. IsConnWasIdle is whether this connection was obtained from an
idle pool. RemoteAddr returns the remote network address. RequestAttempt is to represent the request attempt made during a Resty
request execution flow, including retry count. ResponseTime is a duration since first response byte from server to
request completion. ServerTime is a duration that server took to respond first byte. TCPConnTime is a duration that took to obtain the TCP connection. TLSHandshake is a duration that TLS handshake took place. TotalTime is a duration that total request took end-to-end.
func (*Request).TraceInfo() TraceInfo
Backoff retries with increasing timeout duration up until X amount of retries
(Default is 3 attempts, Override with option Retries(n))
DetectContentType method is used to figure out `Request.Body` content type for request header
DomainCheckRedirectPolicy is convenient method to define domain name redirect rule in resty client.
Redirect is allowed for only mentioned host in the policy.
resty.SetRedirectPolicy(DomainCheckRedirectPolicy("host1.com", "host2.org", "host3.net"))
FlexibleRedirectPolicy is convenient method to create No of redirect policy for HTTP client.
resty.SetRedirectPolicy(FlexibleRedirectPolicy(20))
IsJSONType method is to check JSON content type or not
IsStringEmpty method tells whether given string is empty or not
IsXMLType method is to check XML content type or not
MaxWaitTime sets the max wait time to sleep between requests
New method creates a new Resty client.
NewWithClient method creates a new Resty client with given `http.Client`.
NewWithLocalAddr method creates a new Resty client with given Local Address
to dial from.
NoRedirectPolicy is used to disable redirects in the HTTP client
resty.SetRedirectPolicy(NoRedirectPolicy())
ResetMultipartReaders sets a boolean value which will lead the start being seeked out
on all multipart file readers, if they implement io.ReadSeeker
Retries sets the max number of retries
RetryConditions sets the conditions that will be checked for retry.
RetryHooks sets the hooks that will be executed after each retry
Unmarshalc content into object from JSON or XML
WaitTime sets the default wait time to sleep between requests
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.