diff --git a/docs/client/examples.md b/docs/client/examples.md index d5f8190cde..2ea79609da 100644 --- a/docs/client/examples.md +++ b/docs/client/examples.md @@ -2,7 +2,7 @@ id: examples title: 🍳 Examples description: >- -Client usage examples. + Client usage examples. sidebar_position: 5 --- diff --git a/docs/client/hooks.md b/docs/client/hooks.md index 3ae510f354..3115cf8e05 100644 --- a/docs/client/hooks.md +++ b/docs/client/hooks.md @@ -4,6 +4,7 @@ title: 🎣 Hooks description: >- Hooks are used to manipulate request/response proccess of Fiber client. sidebar_position: 4 +toc --- With hooks, you can manipulate the client on before request/after response stages or more complex logging/tracing cases. diff --git a/docs/client/request.md b/docs/client/request.md index c910fc9540..a5a025bdad 100644 --- a/docs/client/request.md +++ b/docs/client/request.md @@ -43,6 +43,82 @@ type Request struct { } ``` + +## REST Methods + +### Get + +Get sends the GET request. +It sets the URL and HTTP method, and then it sends the request. + +```go title="Signature" +func (r *Request) Get(url string) (*Response, error) +``` + +### Post + +Post sends the POST request. +It sets the URL and HTTP method, and then it sends the request. + +```go title="Signature" +func (r *Request) Post(url string) (*Response, error) +``` + +### Put + +Put sends the PUT request. +It sets the URL and HTTP method, and then it sends the request. + +```go title="Signature" +func (r *Request) Put(url string) (*Response, error) +``` + +### Patch + +Patch sends the PATCH request. +It sets the URL and HTTP method, and then it sends the request. + +```go title="Signature" +func (r *Request) Patch(url string) (*Response, error) +``` + +### Delete + +Delete sends the DELETE request. +It sets the URL and HTTP method, and then it sends the request. + +```go title="Signature" +func (r *Request) Delete(url string) (*Response, error) +``` + +### Head + +Head sends the HEAD request. +It sets the URL and HTTP method, and then it sends the request. + +```go title="Signature" +func (r *Request) Head(url string) (*Response, error) +``` + +### Options + +Options sends the OPTIONS request. +It sets the URL and HTTP method, and then it sends the request. + +```go title="Signature" +func (r *Request) Options(url string) (*Response, error) +``` + +### Custom + +Custom sends a request with custom HTTP method. +It sets the URL and HTTP method, and then it sends the request. +You can use Custom to send requests with methods like TRACE, CONNECT. + +```go title="Signature" +func (r *Request) Custom(url, method string) (*Response, error) +``` + ## AcquireRequest AcquireRequest returns an empty request object from the pool. @@ -135,7 +211,7 @@ Header method returns header value via key, this method will visit all field in func (r *Request) Header(key string) []string ``` -## AddHeader +### AddHeader AddHeader method adds a single header field and its value in the request instance. @@ -177,7 +253,7 @@ fmt.Println(resp.String()) -## SetHeader +### SetHeader SetHeader method sets a single header field and its value in the request instance. It will override the header which has been set in the client instance. @@ -219,7 +295,7 @@ fmt.Println(resp.String()) -## AddHeaders +### AddHeaders AddHeaders method adds multiple header fields and its values at one go in the request instance. @@ -227,7 +303,7 @@ AddHeaders method adds multiple header fields and its values at one go in the re func (r *Request) AddHeaders(h map[string][]string) *Request ``` -## SetHeaders +### SetHeaders SetHeaders method sets multiple header fields and its values at one go in the request instance. It will override the header which has been set in the client instance. @@ -244,7 +320,7 @@ Param method returns params value via key, this method will visit all field in t func (r *Request) Param(key string) []string ``` -## AddParam +### AddParam AddParam method adds a single param field and its value in the request instance. @@ -285,7 +361,7 @@ fmt.Println(string(resp.Body())) -## SetParam +### SetParam SetParam method sets a single param field and its value in the request instance. It will override param, which has been set in client instance. @@ -294,7 +370,7 @@ It will override param, which has been set in client instance. func (r *Request) SetParam(key, val string) *Request ``` -## AddParams +### AddParams AddParams method adds multiple param fields and its values at one go in the request instance. @@ -302,7 +378,7 @@ AddParams method adds multiple param fields and its values at one go in the requ func (r *Request) AddParams(m map[string][]string) *Request ``` -## SetParams +### SetParams SetParams method sets multiple param fields and its values at one go in the request instance. It will override param, which has been set in client instance. @@ -311,7 +387,7 @@ It will override param, which has been set in client instance. func (r *Request) SetParams(m map[string]string) *Request ``` -## SetParamsWithStruct +### SetParamsWithStruct SetParamsWithStruct method sets multiple param fields and its values at one go in the request instance. It will override param, which has been set in client instance. @@ -360,7 +436,7 @@ fmt.Println(string(resp.Body())) -## DelParams +### DelParams DelParams method deletes single or multiple param fields and their values. @@ -426,7 +502,7 @@ Cookie returns the cookie set in the request instance. If the cookie doesn't exi func (r *Request) Cookie(key string) string ``` -## SetCookie +### SetCookie SetCookie method sets a single cookie field and its value in the request instance. It will override the cookie which is set in the client instance. @@ -435,7 +511,7 @@ It will override the cookie which is set in the client instance. func (r *Request) SetCookie(key, val string) *Request ``` -## SetCookies +### SetCookies SetCookies method sets multiple cookie fields and its values at one go in the request instance. It will override the cookie which is set in the client instance. @@ -474,7 +550,7 @@ fmt.Println(string(resp.Body())) -## SetCookiesWithStruct +### SetCookiesWithStruct SetCookiesWithStruct method sets multiple cookie fields and its values at one go in the request instance. It will override the cookie which is set in the client instance. @@ -483,7 +559,7 @@ It will override the cookie which is set in the client instance. func (r *Request) SetCookiesWithStruct(v any) *Request ``` -## DelCookies +### DelCookies DelCookies method deletes single or multiple cookie fields ant its values. @@ -499,7 +575,7 @@ PathParam returns the path param set in the request instance. If the path param func (r *Request) PathParam(key string) string ``` -## SetPathParam +### SetPathParam SetPathParam method sets a single path param field and its value in the request instance. It will override path param which set in client instance. @@ -531,7 +607,7 @@ Gofiber -## SetPathParams +### SetPathParams SetPathParams method sets multiple path param fields and its values at one go in the request instance. It will override path param which set in client instance. @@ -540,7 +616,7 @@ It will override path param which set in client instance. func (r *Request) SetPathParams(m map[string]string) *Request ``` -## SetPathParamsWithStruct +### SetPathParamsWithStruct SetPathParamsWithStruct method sets multiple path param fields and its values at one go in the request instance. It will override path param which set in client instance. @@ -549,7 +625,7 @@ It will override path param which set in client instance. func (r *Request) SetPathParamsWithStruct(v any) *Request ``` -## DelPathParams +### DelPathParams DelPathParams method deletes single or multiple path param fields ant its values. @@ -557,7 +633,7 @@ DelPathParams method deletes single or multiple path param fields ant its values func (r *Request) DelPathParams(key ...string) *Request ``` -## ResetPathParams +### ResetPathParams ResetPathParams deletes all path params. @@ -597,7 +673,7 @@ FormData method returns form data value via key, this method will visit all fiel func (r *Request) FormData(key string) []string ``` -## AddFormData +### AddFormData AddFormData method adds a single form data field and its value in the request instance. @@ -642,7 +718,7 @@ fmt.Println(string(resp.Body())) -## SetFormData +### SetFormData SetFormData method sets a single form data field and its value in the request instance. @@ -683,7 +759,7 @@ fmt.Println(string(resp.Body())) -## AddFormDatas +### AddFormDatas AddFormDatas method adds multiple form data fields and its values in the request instance. @@ -691,7 +767,7 @@ AddFormDatas method adds multiple form data fields and its values in the request func (r *Request) AddFormDatas(m map[string][]string) *Request ``` -## SetFormDatas +### SetFormDatas SetFormDatas method sets multiple form data fields and its values in the request instance. @@ -699,7 +775,7 @@ SetFormDatas method sets multiple form data fields and its values in the request func (r *Request) SetFormDatas(m map[string]string) *Request ``` -## SetFormDatas +### SetFormDatas SetFormDatas method sets multiple form data fields and its values in the request instance. @@ -707,7 +783,7 @@ SetFormDatas method sets multiple form data fields and its values in the request func (r *Request) SetFormDatas(m map[string]string) *Request ``` -## SetFormDatasWithStruct +### SetFormDatasWithStruct SetFormDatasWithStruct method sets multiple form data fields and its values in the request instance via struct. @@ -715,7 +791,7 @@ SetFormDatasWithStruct method sets multiple form data fields and its values in t func (r *Request) SetFormDatasWithStruct(v any) *Request ``` -## DelFormDatas +### DelFormDatas DelFormDatas method deletes multiple form data fields and its value in the request instance. @@ -732,7 +808,7 @@ If the name field is empty, it will try to match path. func (r *Request) File(name string) *File ``` -## FileByPath +### FileByPath FileByPath returns file ptr store in request obj by path. @@ -740,7 +816,7 @@ FileByPath returns file ptr store in request obj by path. func (r *Request) FileByPath(path string) *File ``` -## AddFile +### AddFile AddFile method adds a single file field and its value in the request instance via file path. @@ -779,7 +855,7 @@ fmt.Println(string(resp.Body())) -## AddFileWithReader +### AddFileWithReader AddFileWithReader method adds a single field and its value in the request instance via reader. @@ -819,7 +895,7 @@ fmt.Println(string(resp.Body())) -## AddFiles +### AddFiles AddFiles method adds multiple file fields and its value in the request instance via File instance. @@ -918,79 +994,6 @@ It will override max redirect, which is set in the client instance. func (r *Request) SetMaxRedirects(count int) *Request ``` -## Get - -Get sends the GET request. -It sets the URL and HTTP method, and then it sends the request. - -```go title="Signature" -func (r *Request) Get(url string) (*Response, error) -``` - -## Post - -Post sends the POST request. -It sets the URL and HTTP method, and then it sends the request. - -```go title="Signature" -func (r *Request) Post(url string) (*Response, error) -``` - -## Head - -Head sends the HEAD request. -It sets the URL and HTTP method, and then it sends the request. - -```go title="Signature" -func (r *Request) Head(url string) (*Response, error) -``` - -## Put - -Put sends the PUT request. -It sets the URL and HTTP method, and then it sends the request. - -```go title="Signature" -func (r *Request) Put(url string) (*Response, error) -``` - -## Delete - -Delete sends the DELETE request. -It sets the URL and HTTP method, and then it sends the request. - -```go title="Signature" -func (r *Request) Delete(url string) (*Response, error) -``` - -## Options - -Options sends the OPTIONS request. -It sets the URL and HTTP method, and then it sends the request. - -```go title="Signature" -func (r *Request) Options(url string) (*Response, error) -``` - -## Patch - -Patch sends the PATCH request. -It sets the URL and HTTP method, and then it sends the request. - -```go title="Signature" -func (r *Request) Patch(url string) (*Response, error) -``` - -## Custom - -Custom sends a request with custom HTTP method. -It sets the URL and HTTP method, and then it sends the request. -You can use Custom to send requests with methods like TRACE, CONNECT. - -```go title="Signature" -func (r *Request) Custom(url, method string) (*Response, error) -``` - ## Send Send sends HTTP request. diff --git a/docs/client/rest.md b/docs/client/rest.md index c65e361961..9b34b80f42 100644 --- a/docs/client/rest.md +++ b/docs/client/rest.md @@ -4,6 +4,7 @@ title: 🖥️ REST description: >- HTTP client for Gofiber. sidebar_position: 1 +toc_max_heading_level: 5 --- The Fiber Client for Fiber v3 is a powerful HTTP client optimized for high performance and ease of use in server-side applications. Built on top of the robust FastHTTP library, it inherits FastHTTP's high-speed HTTP protocol implementation. The client is designed to make HTTP requests both internally within services or externally to other web services. @@ -118,20 +119,20 @@ Post provides an API like axios which send post request. func (c *Client) Post(url string, cfg ...Config) (*Response, error) ``` -### Head +### Put -Head provides an API like axios which send head request. +Put provides an API like axios which send put request. ```go title="Signature" -func (c *Client) Head(url string, cfg ...Config) (*Response, error) +func (c *Client) Put(url string, cfg ...Config) (*Response, error) ``` -### Put +### Patch -Put provides an API like axios which send put request. +Patch provides an API like axios which send patch request. ```go title="Signature" -func (c *Client) Put(url string, cfg ...Config) (*Response, error) +func (c *Client) Patch(url string, cfg ...Config) (*Response, error) ``` ### Delete @@ -142,20 +143,20 @@ Delete provides an API like axios which send delete request. func (c *Client) Delete(url string, cfg ...Config) (*Response, error) ``` -### Options +### Head -Options provides an API like axios which send options request. +Head provides an API like axios which send head request. ```go title="Signature" -func (c *Client) Options(url string, cfg ...Config) (*Response, error) +func (c *Client) Head(url string, cfg ...Config) (*Response, error) ``` -### Patch +### Options -Patch provides an API like axios which send patch request. +Options provides an API like axios which send options request. ```go title="Signature" -func (c *Client) Patch(url string, cfg ...Config) (*Response, error) +func (c *Client) Options(url string, cfg ...Config) (*Response, error) ``` ### Custom @@ -201,7 +202,9 @@ It acquires a request from the pool. You have to release it using `ReleaseReques func (c *Client) R() *Request ``` -### RequestHook +### Hooks + +#### RequestHook RequestHook Request returns user-defined request hooks. @@ -209,23 +212,23 @@ RequestHook Request returns user-defined request hooks. func (c *Client) RequestHook() []RequestHook ``` -### AddRequestHook +#### ResponseHook -AddRequestHook Add user-defined request hooks. +ResponseHook return user-define response hooks. ```go title="Signature" -func (c *Client) AddRequestHook(h ...RequestHook) *Client +func (c *Client) ResponseHook() []ResponseHook ``` -### ResponseHook +#### AddRequestHook -ResponseHook return user-define response hooks. +AddRequestHook Add user-defined request hooks. ```go title="Signature" -func (c *Client) ResponseHook() []ResponseHook +func (c *Client) AddRequestHook(h ...RequestHook) *Client ``` -### AddResponseHook +#### AddResponseHook AddResponseHook Add user-defined response hooks. @@ -233,7 +236,9 @@ AddResponseHook Add user-defined response hooks. func (c *Client) AddResponseHook(h ...ResponseHook) *Client ``` -### JSONMarshal +### JSON + +#### JSONMarshal JSONMarshal returns json marshal function in Core. @@ -241,23 +246,23 @@ JSONMarshal returns json marshal function in Core. func (c *Client) JSONMarshal() utils.JSONMarshal ``` -### SetJSONMarshal +#### JSONUnmarshal -SetJSONMarshal sets the JSON encoder. +JSONUnmarshal returns json unmarshal function in Core. ```go title="Signature" -func (c *Client) SetJSONMarshal(f utils.JSONMarshal) *Client +func (c *Client) JSONUnmarshal() utils.JSONUnmarshal ``` -### JSONUnmarshal +#### SetJSONMarshal -JSONUnmarshal returns json unmarshal function in Core. +SetJSONMarshal sets the JSON encoder. ```go title="Signature" -func (c *Client) JSONUnmarshal() utils.JSONUnmarshal +func (c *Client) SetJSONMarshal(f utils.JSONMarshal) *Client ``` -### SetJSONUnmarshal +#### SetJSONUnmarshal Set the JSON decoder. @@ -265,7 +270,9 @@ Set the JSON decoder. func (c *Client) SetJSONUnmarshal(f utils.JSONUnmarshal) *Client ``` -### XMLMarshal +### XML + +#### XMLMarshal XMLMarshal returns xml marshal function in Core. @@ -273,23 +280,23 @@ XMLMarshal returns xml marshal function in Core. func (c *Client) XMLMarshal() utils.XMLMarshal ``` -### SetXMLMarshal +#### XMLUnmarshal -SetXMLMarshal sets the XML encoder. +XMLUnmarshal returns xml unmarshal function in Core. ```go title="Signature" -func (c *Client) SetXMLMarshal(f utils.XMLMarshal) *Client +func (c *Client) XMLUnmarshal() utils.XMLUnmarshal ``` -### XMLUnmarshal +#### SetXMLMarshal -XMLUnmarshal returns xml unmarshal function in Core. +SetXMLMarshal sets the XML encoder. ```go title="Signature" -func (c *Client) XMLUnmarshal() utils.XMLUnmarshal +func (c *Client) SetXMLMarshal(f utils.XMLMarshal) *Client ``` -### SetXMLUnmarshal +#### SetXMLUnmarshal SetXMLUnmarshal sets the XML decoder. @@ -297,7 +304,9 @@ SetXMLUnmarshal sets the XML decoder. func (c *Client) SetXMLUnmarshal(f utils.XMLUnmarshal) *Client ``` -### TLSConfig +### TLS + +#### TLSConfig TLSConfig returns tlsConfig in client. If the client doesn't have a tlsConfig, this function will initialize it. @@ -306,7 +315,7 @@ If the client doesn't have a tlsConfig, this function will initialize it. func (c *Client) TLSConfig() *tls.Config ``` -### SetTLSConfig +#### SetTLSConfig SetTLSConfig sets tlsConfig in client. @@ -314,7 +323,7 @@ SetTLSConfig sets tlsConfig in client. func (c *Client) SetTLSConfig(config *tls.Config) *Client ``` -### SetCertificates +#### SetCertificates SetCertificates method sets client certificates into client. @@ -322,7 +331,7 @@ SetCertificates method sets client certificates into client. func (c *Client) SetCertificates(certs ...tls.Certificate) *Client ``` -### SetRootCertificate +#### SetRootCertificate SetRootCertificate adds one or more root certificates into client. @@ -330,7 +339,7 @@ SetRootCertificate adds one or more root certificates into client. func (c *Client) SetRootCertificate(path string) *Client ``` -### SetRootCertificateFromString +#### SetRootCertificateFromString SetRootCertificateFromString method adds one or more root certificates into the client. @@ -409,7 +418,7 @@ Header method returns header value via key, this method will visit all field in func (c *Client) Header(key string) []string ``` -### AddHeader +#### AddHeader AddHeader method adds a single header field and its value in the client instance. These headers will be applied to all requests raised from this client instance. @@ -419,7 +428,7 @@ Also, it can be overridden at request level header options. func (c *Client) AddHeader(key, val string) *Client ``` -### SetHeader +#### SetHeader 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. @@ -429,7 +438,7 @@ Also, it can be overridden at request level header options. func (c *Client) SetHeader(key, val string) *Client ``` -### AddHeaders +#### AddHeaders AddHeaders method adds 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. @@ -439,7 +448,7 @@ Also it can be overridden at request level headers options. func (c *Client) AddHeaders(h map[string][]string) *Client ``` -### SetHeaders +#### SetHeaders 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. @@ -457,7 +466,7 @@ Param method returns params value via key, this method will visit all field in t func (c *Client) Param(key string) []string ``` -### AddParam +#### AddParam AddParam method adds a single query param field and its value in the client instance. These params will be applied to all requests raised from this client instance. @@ -467,7 +476,7 @@ Also, it can be overridden at request level param options. func (c *Client) AddParam(key, val string) *Client ``` -### SetParam +#### SetParam SetParam method sets a single query param field and its value in the client instance. These params will be applied to all requests raised from this client instance. @@ -477,7 +486,7 @@ Also, it can be overridden at request level param options. func (c *Client) SetParam(key, val string) *Client ``` -### AddParams +#### AddParams AddParams method adds multiple query params field and its values at one go in the client instance. These params will be applied to all requests raised from this client instance. @@ -487,7 +496,7 @@ Also it can be overridden at request level params options. func (c *Client) AddParams(m map[string][]string) *Client ``` -### SetParams +#### SetParams SetParams method sets multiple params field and its values at one go in the client instance. These params will be applied to all requests raised from this client instance. @@ -497,7 +506,7 @@ Also it can be overridden at request level params options. func (c *Client) SetParams(m map[string]string) *Client ``` -### SetParamsWithStruct +#### SetParamsWithStruct SetParamsWithStruct method sets multiple params field and its values at one go in the client instance. These params will be applied to all requests raised from this client instance. @@ -507,7 +516,7 @@ Also it can be overridden at request level params options. func (c *Client) SetParamsWithStruct(v any) *Client ``` -### DelParams +#### DelParams DelParams method deletes single or multiple params field and its values in client. @@ -544,7 +553,7 @@ If the path param doesn't exist, return empty string. func (c *Client) PathParam(key string) string ``` -### SetPathParam +#### SetPathParam SetPathParam method sets a single path param field and its value in the client instance. These path params will be applied to all requests raised from this client instance. @@ -554,7 +563,7 @@ Also it can be overridden at request level path params options. func (c *Client) SetPathParam(key, val string) *Client ``` -### SetPathParams +#### SetPathParams SetPathParams method sets multiple path params field and its values at one go in the client instance. These path params will be applied to all requests raised from this client instance. @@ -564,7 +573,7 @@ Also it can be overridden at request level path params options. func (c *Client) SetPathParams(m map[string]string) *Client ``` -### SetPathParamsWithStruct +#### SetPathParamsWithStruct SetPathParamsWithStruct method sets multiple path params field and its values at one go in the client instance. These path params will be applied to all requests raised from this client instance. @@ -574,7 +583,7 @@ Also it can be overridden at request level path params options. func (c *Client) SetPathParamsWithStruct(v any) *Client ``` -### DelPathParams +#### DelPathParams DelPathParams method deletes single or multiple path params field and its values in client. @@ -591,7 +600,7 @@ If cookie doesn't exist, return empty string. func (c *Client) Cookie(key string) string ``` -### SetCookie +#### SetCookie SetCookie method sets a single cookie field and its value in the client instance. These cookies will be applied to all requests raised from this client instance. @@ -625,7 +634,7 @@ fmt.Println(string(resp.Body())) ``` -### SetCookies +#### SetCookies SetCookies method sets multiple cookies field and its values at one go in the client instance. These cookies will be applied to all requests raised from this client instance. @@ -635,7 +644,7 @@ Also it can be overridden at request level cookie options. func (c *Client) SetCookies(m map[string]string) *Client ``` -### SetCookiesWithStruct +#### SetCookiesWithStruct SetCookiesWithStruct method sets multiple cookies field and its values at one go in the client instance. These cookies will be applied to all requests raised from this client instance. @@ -645,17 +654,7 @@ Also it can be overridden at request level cookies options. func (c *Client) SetCookiesWithStruct(v any) *Client ``` -### SetCookiesWithStruct - -SetCookiesWithStruct method sets multiple cookies field and its values at one go in the client instance. -These cookies will be applied to all requests raised from this client instance. -Also it can be overridden at request level cookies options. - -```go title="Signature" -func (c *Client) SetCookiesWithStruct(v any) *Client -``` - -### DelCookies +#### DelCookies DelCookies method deletes single or multiple cookies field and its values in client. @@ -681,7 +680,7 @@ Debug enable log debug level output. func (c *Client) Debug() *Client ``` -### DisableDebug +#### DisableDebug DisableDebug disables log debug level output. @@ -691,14 +690,6 @@ func (c *Client) DisableDebug() *Client ### SetCookieJar -DisableDebug disables log debug level output. - -```go title="Signature" -func (c *Client) SetCookieJar(cookieJar *CookieJar) *Client -``` - -### SetCookieJar - SetCookieJar sets cookie jar in client instance. ```go title="Signature" @@ -747,19 +738,7 @@ You can configurate it as you wish or replace it with another clients. C gets default client. ```go title="Signature" -func C() -``` - -### Replace - -Replace the defaultClient, the returned function can undo. - -:::caution -The default client should not be changed concurrently. -::: - -```go title="Signature" -func Replace() +func C() *Client ``` ### Get @@ -778,20 +757,20 @@ Post is a convenience method that sends a POST request using the `defaultClient` func Post(url string, cfg ...Config) (*Response, error) ``` -### Head +### Put -Head sends a HEAD request using the `defaultClient`, a convenience method. +Put is a convenience method that sends a PUT request using the `defaultClient`. ```go title="Signature" -func Head(url string, cfg ...Config) (*Response, error) +func Put(url string, cfg ...Config) (*Response, error) ``` -### Put +### Patch -Put is a convenience method that sends a PUT request using the `defaultClient`. +Patch is a convenience method that sends a PATCH request using the `defaultClient`. ```go title="Signature" -func Put(url string, cfg ...Config) (*Response, error) +func Patch(url string, cfg ...Config) (*Response, error) ``` ### Delete @@ -802,6 +781,14 @@ Delete is a convenience method that sends a DELETE request using the `defaultCli func Delete(url string, cfg ...Config) (*Response, error) ``` +### Head + +Head sends a HEAD request using the `defaultClient`, a convenience method. + +```go title="Signature" +func Head(url string, cfg ...Config) (*Response, error) +``` + ### Options Options is a convenience method that sends an OPTIONS request using the `defaultClient`. @@ -810,10 +797,14 @@ Options is a convenience method that sends an OPTIONS request using the `default func Options(url string, cfg ...Config) (*Response, error) ``` -### Patch +### Replace -Patch is a convenience method that sends a PATCH request using the `defaultClient`. +Replace the defaultClient, the returned function can undo. + +:::caution +The default client should not be changed concurrently. +::: ```go title="Signature" -func Patch(url string, cfg ...Config) (*Response, error) +func Replace(c *Client) func() ```