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

jeffotoni / quick / 222

06 Mar 2025 08:13PM UTC coverage: 49.298% (-0.03%) from 49.324%
222

push

circleci

jeffotoni
Bug fixed nil pointer bug in WithRetry

1 of 10 new or added lines in 2 files covered. (10.0%)

1826 of 3704 relevant lines covered (49.3%)

2694.53 hits per line

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

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

3
import (
4
        "context"
5
        "fmt"
6
        "log"
7
        "net/http"
8
        "net/http/cookiejar"
9
        "time"
10

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

14
func main() {
×
15
        // Creating a CookieJar to manage cookies automatically.
×
16
        jar, _ := cookiejar.New(nil)
×
17

×
18
        // Creating a fully custom *http.Client.
×
19
        customHTTPClient := &http.Client{
×
20
                Timeout: 10 * time.Second,
×
21
                Jar:     jar, // Uses a CookieJar to store cookies.
×
22
        }
×
23

×
24
        // Creating a quick client using the custom *http.Client.
×
25
        cClient := client.New(
×
26
                client.WithCustomHTTPClient(customHTTPClient), // Uses the pre-configured HTTP client.
×
27
                client.WithContext(context.Background()),      // Sets a request context.
×
28
                client.WithHeaders(map[string]string{
×
29
                        "User-Agent": "QuickClient/1.0",
×
30
                }),
×
31
                client.WithRetry(client.RetryConfig{
×
NEW
32
                        MaxRetries:   3,                         // Maximum number of retries.
×
NEW
33
                        Delay:        2 * time.Second,           // Delay between attempts.
×
NEW
34
                        UseBackoff:   true,                      // Use exponential backoff.
×
NEW
35
                        Statuses:     []int{500, 502, 503, 504}, // HTTP statuses for retry.
×
NEW
36
                        FailoverURLs: []string{"http://hosterror", "https://httpbin.org/post"},
×
NEW
37
                        EnableLog:    true, // Enable logging.
×
38
                }),
×
39
        )
×
40

×
41
        // Making a POST request.
×
NEW
42
        resp, err := cClient.Post("https://httpbin_error.org/post", map[string]string{"name": "jeffotoni"})
×
43
        if err != nil {
×
44
                log.Fatalf("POST request failed: %v", err)
×
45
        }
×
46

47
        fmt.Println("POST Form Response:", string(resp.Body))
×
48
}
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