• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jeffotoni / quick / 214

04 Mar 2025 07:11AM UTC coverage: 49.209% (-26.0%) from 75.221%
214

push

circleci

jeffotoni
Merge branch 'feature/refactory_http_client'

new version http client

32 of 1275 new or added lines in 44 files covered. (2.51%)

15 existing lines in 1 file now uncovered.

1803 of 3664 relevant lines covered (49.21%)

2724.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/example/quick.http.client/full.retray/main.go
1
package main
2

3
import (
4
        "crypto/tls"
5
        "fmt"
6
        "log"
7
        "net/http"
8
        "time"
9

10
        "github.com/jeffotoni/quick/http/client"
11
)
12

NEW
13
func main() {
×
NEW
14

×
NEW
15
        // when I declare the 2 retrys, WithRetry RoundTripper and WithRetry ,
×
NEW
16
        // the With Retry RoundTripper overrides it which is executed.
×
NEW
17
        cClient := client.New(
×
NEW
18
                client.WithTimeout(5*time.Second),
×
NEW
19
                client.WithHeaders(map[string]string{"Content-Type": "application/json"}),
×
NEW
20

×
NEW
21
                // Advanced HTTP transport configuration
×
NEW
22
                client.WithTransportConfig(&http.Transport{
×
NEW
23
                        Proxy:               http.ProxyFromEnvironment,
×
NEW
24
                        TLSClientConfig:     &tls.Config{InsecureSkipVerify: true},
×
NEW
25
                        ForceAttemptHTTP2:   true,
×
NEW
26
                        MaxIdleConns:        20,
×
NEW
27
                        MaxIdleConnsPerHost: 10,
×
NEW
28
                        MaxConnsPerHost:     20,
×
NEW
29
                        DisableKeepAlives:   false,
×
NEW
30
                }),
×
NEW
31

×
NEW
32
                // Automatic retry via RoundTripper
×
NEW
33
                client.WithRetryRoundTripper(
×
NEW
34
                        client.RetryConfig{
×
NEW
35
                                MaxRetries: 2,
×
NEW
36
                                Delay:      1 * time.Second,
×
NEW
37
                                UseBackoff: true,
×
NEW
38
                                Statuses:   []int{500},
×
NEW
39
                                EnableLog:  true,
×
NEW
40
                        }),
×
NEW
41

×
NEW
42
                // Retry quick
×
NEW
43
                // client.WithRetry(5, "2s-bex", "500,502,503,504"),
×
NEW
44
        )
×
NEW
45

×
NEW
46
        resp, err := cClient.Post("http://localhost:3000/v1/user", map[string]string{"name": "jeffotoni"})
×
NEW
47
        if err != nil {
×
NEW
48
                log.Fatalf("POST request failed: %v", err)
×
NEW
49
        }
×
NEW
50
        fmt.Println("POST Form Response:", string(resp.Body))
×
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc