...
1
2
3
4
5
6 package resty
7
8 import (
9 "net"
10 "net/http"
11 "net/http/cookiejar"
12
13 "golang.org/x/net/publicsuffix"
14 )
15
16
17 const Version = "2.7.0"
18
19
20 func New() *Client {
21 cookieJar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
22 return createClient(&http.Client{
23 Jar: cookieJar,
24 })
25 }
26
27
28 func NewWithClient(hc *http.Client) *Client {
29 return createClient(hc)
30 }
31
32
33
34 func NewWithLocalAddr(localAddr net.Addr) *Client {
35 cookieJar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
36 return createClient(&http.Client{
37 Jar: cookieJar,
38 Transport: createTransport(localAddr),
39 })
40 }
41
View as plain text