@@ -220,6 +220,9 @@ The returned value is valid until the request object is released. Any future cal
220
220
func (r *Request) Headers() iter.Seq2[string, []string]
221
221
```
222
222
223
+ <details>
224
+ <summary>Example</summary>
225
+
223
226
```go title="Example"
224
227
req := client.AcquireRequest()
225
228
@@ -232,16 +235,16 @@ for k, v := range req.Headers() {
232
235
}
233
236
```
234
237
235
- <details >
236
- <summary >Click here to see the result</summary >
237
-
238
238
``` sh
239
239
Header Key: Golang, Header Value: [Fiber]
240
240
Header Key: Test, Header Value: [123456 654321]
241
241
```
242
242
243
243
</details >
244
244
245
+ <details >
246
+ <summary >Example with maps.Collect()</summary >
247
+
245
248
``` go title="Example with maps.Collect()"
246
249
req := client.AcquireRequest ()
247
250
@@ -255,9 +258,6 @@ for k, v := range headers {
255
258
}
256
259
```
257
260
258
- <details >
259
- <summary >Click here to see the result</summary >
260
-
261
261
``` sh
262
262
Header Key: Golang, Header Value: [Fiber]
263
263
Header Key: Test, Header Value: [123456 654321]
@@ -273,6 +273,9 @@ AddHeader method adds a single header field and its value in the request instanc
273
273
func (r *Request ) AddHeader (key , val string ) *Request
274
274
```
275
275
276
+ <details>
277
+ <summary>Example</summary>
278
+
276
279
```go title="Example"
277
280
req := client.AcquireRequest()
278
281
defer client.ReleaseRequest(req)
@@ -289,9 +292,6 @@ if err != nil {
289
292
fmt.Println (resp.String ())
290
293
```
291
294
292
- <details >
293
- <summary >Click here to see the result</summary >
294
-
295
295
``` json
296
296
{
297
297
"headers" : {
@@ -316,6 +316,9 @@ It will override the header which has been set in the client instance.
316
316
func (r *Request ) SetHeader (key , val string ) *Request
317
317
```
318
318
319
+ <details>
320
+ <summary>Example</summary>
321
+
319
322
```go title="Example"
320
323
req := client.AcquireRequest()
321
324
defer client.ReleaseRequest(req)
@@ -331,9 +334,6 @@ if err != nil {
331
334
fmt.Println (resp.String ())
332
335
```
333
336
334
- <details >
335
- <summary >Click here to see the result</summary >
336
-
337
337
``` json
338
338
{
339
339
"headers" : {
@@ -391,6 +391,9 @@ AddParam method adds a single param field and its value in the request instance.
391
391
func (r *Request) AddParam(key, val string) *Request
392
392
```
393
393
394
+ <details>
395
+ <summary>Example</summary>
396
+
394
397
```go title="Example"
395
398
req := client.AcquireRequest()
396
399
defer client.ReleaseRequest(req)
@@ -407,9 +410,6 @@ if err != nil {
407
410
fmt.Println (string (resp.Body ()))
408
411
```
409
412
410
- <details >
411
- <summary >Click here to see the result</summary >
412
-
413
413
``` json
414
414
{
415
415
"Content-Length" : " 145" ,
@@ -459,6 +459,9 @@ It will override param, which has been set in client instance.
459
459
func (r *Request) SetParamsWithStruct(v any) *Request
460
460
```
461
461
462
+ <details>
463
+ <summary>Example</summary>
464
+
462
465
```go title="Example"
463
466
req := client.AcquireRequest()
464
467
defer client.ReleaseRequest(req)
@@ -482,9 +485,6 @@ if err != nil {
482
485
fmt.Println (string (resp.Body ()))
483
486
```
484
487
485
- <details >
486
- <summary >Click here to see the result</summary >
487
-
488
488
``` json
489
489
{
490
490
"Content-Length" : " 147" ,
@@ -591,6 +591,9 @@ It will override the cookie which is set in the client instance.
591
591
func (r *Request) SetCookies(m map[string]string) *Request
592
592
```
593
593
594
+ <details>
595
+ <summary>Example</summary>
596
+
594
597
```go title="Example"
595
598
req := client.AcquireRequest()
596
599
defer client.ReleaseRequest(req)
@@ -608,9 +611,6 @@ if err != nil {
608
611
fmt.Println (string (resp.Body ()))
609
612
```
610
613
611
- <details >
612
- <summary >Click here to see the result</summary >
613
-
614
614
``` json
615
615
{
616
616
"cookies" : {
@@ -663,6 +663,9 @@ It will override path param which set in client instance.
663
663
func (r *Request) SetPathParam(key, val string) *Request
664
664
```
665
665
666
+ <details>
667
+ <summary>Example</summary>
668
+
666
669
```go title="Example"
667
670
req := client.AcquireRequest()
668
671
defer client.ReleaseRequest(req)
@@ -677,9 +680,6 @@ if err != nil {
677
680
fmt.Println (string (resp.Body ()))
678
681
```
679
682
680
- <details >
681
- <summary >Click here to see the result</summary >
682
-
683
683
``` plaintext
684
684
Gofiber
685
685
```
@@ -777,6 +777,9 @@ AddFormData method adds a single form data field and its value in the request in
777
777
func (r *Request) AddFormData(key, val string) *Request
778
778
```
779
779
780
+ <details>
781
+ <summary>Example</summary>
782
+
780
783
```go title="Example"
781
784
req := client.AcquireRequest()
782
785
defer client.ReleaseRequest(req)
@@ -793,9 +796,6 @@ if err != nil {
793
796
fmt.Println (string (resp.Body ()))
794
797
```
795
798
796
- <details >
797
- <summary >Click here to see the result</summary >
798
-
799
799
``` json
800
800
{
801
801
"args" : {},
@@ -822,6 +822,9 @@ SetFormData method sets a single form data field and its value in the request in
822
822
func (r *Request ) SetFormData (key , val string ) *Request
823
823
```
824
824
825
+ <details>
826
+ <summary>Example</summary>
827
+
825
828
```go title="Example"
826
829
req := client.AcquireRequest()
827
830
defer client.ReleaseRequest(req)
@@ -837,9 +840,6 @@ if err != nil {
837
840
fmt.Println (string (resp.Body ()))
838
841
```
839
842
840
- <details >
841
- <summary >Click here to see the result</summary >
842
-
843
843
``` json
844
844
{
845
845
"args" : {},
@@ -929,6 +929,9 @@ AddFile method adds a single file field and its value in the request instance vi
929
929
func (r *Request) AddFile(path string) *Request
930
930
```
931
931
932
+ <details>
933
+ <summary>Example</summary>
934
+
932
935
```go title="Example"
933
936
req := client.AcquireRequest()
934
937
defer client.ReleaseRequest(req)
@@ -943,9 +946,6 @@ if err != nil {
943
946
fmt.Println (string (resp.Body ()))
944
947
```
945
948
946
- <details >
947
- <summary >Click here to see the result</summary >
948
-
949
949
``` json
950
950
{
951
951
"args" : {},
@@ -968,6 +968,9 @@ AddFileWithReader method adds a single field and its value in the request instan
968
968
func (r *Request ) AddFileWithReader (name string , reader io .ReadCloser ) *Request
969
969
```
970
970
971
+ <details>
972
+ <summary>Example</summary>
973
+
971
974
```go title="Example"
972
975
req := client.AcquireRequest()
973
976
defer client.ReleaseRequest(req)
@@ -983,9 +986,6 @@ if err != nil {
983
986
fmt.Println (string (resp.Body ()))
984
987
```
985
988
986
- <details >
987
- <summary >Click here to see the result</summary >
988
-
989
989
``` json
990
990
{
991
991
"args" : {},
@@ -1025,6 +1025,9 @@ It will override timeout which set in client instance.
1025
1025
func (r *Request) SetTimeout(t time.Duration) *Request
1026
1026
```
1027
1027
1028
+ <details>
1029
+ <summary>Example 1</summary>
1030
+
1028
1031
```go title="Example 1"
1029
1032
req := client.AcquireRequest()
1030
1033
defer client.ReleaseRequest(req)
@@ -1039,9 +1042,6 @@ if err != nil {
1039
1042
fmt.Println (string (resp.Body ()))
1040
1043
```
1041
1044
1042
- <details >
1043
- <summary >Click here to see the result</summary >
1044
-
1045
1045
``` json
1046
1046
{
1047
1047
"args" : {},
@@ -1054,6 +1054,9 @@ fmt.Println(string(resp.Body()))
1054
1054
1055
1055
</details >
1056
1056
1057
+ <details >
1058
+ <summary >Example 2</summary >
1059
+
1057
1060
``` go title="Example 2"
1058
1061
req := client.AcquireRequest ()
1059
1062
defer client.ReleaseRequest (req)
@@ -1068,9 +1071,6 @@ if err != nil {
1068
1071
fmt.Println (string (resp.Body ()))
1069
1072
```
1070
1073
1071
- <details >
1072
- <summary >Click here to see the result</summary >
1073
-
1074
1074
``` shell
1075
1075
panic: timeout or cancel
1076
1076
0 commit comments