• 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/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

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

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

×
NEW
24
        // Creating a quick client using the custom *http.Client.
×
NEW
25
        cClient := client.New(
×
NEW
26
                client.WithCustomHTTPClient(customHTTPClient), // Uses the pre-configured HTTP client.
×
NEW
27
                client.WithContext(context.Background()),      // Sets a request context.
×
NEW
28
                client.WithHeaders(map[string]string{
×
NEW
29
                        "User-Agent": "QuickClient/1.0",
×
NEW
30
                }),
×
NEW
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
                        EnableLog:  true,                      // Enable logging.
×
NEW
37
                }),
×
NEW
38
        )
×
NEW
39

×
NEW
40
        // Making a POST request.
×
NEW
41
        resp, err := cClient.Post("http://localhost:3000/v1/user", map[string]string{"name": "jeffotoni"})
×
NEW
42
        if err != nil {
×
NEW
43
                log.Fatalf("POST request failed: %v", err)
×
NEW
44
        }
×
45

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