This repository was archived by the owner on Jun 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ func (e *DisabledError) Error() string {
27
27
}
28
28
29
29
type Client struct {
30
- client * http.Client
30
+ getClient * http.Client
31
+ postClient * http.Client
31
32
cache * lru.Cache
32
33
logger * log.Logger
33
34
@@ -42,7 +43,8 @@ func NewClient() *Client {
42
43
logger := log .New (log .Writer (), "[GS] " , log .LstdFlags | log .Lmsgprefix )
43
44
44
45
return & Client {
45
- client : & http.Client {Timeout : 15 * time .Second },
46
+ getClient : & http.Client {Timeout : 12 * time .Second },
47
+ postClient : & http.Client {Timeout : 32 * time .Second },
46
48
cache : cache ,
47
49
logger : logger ,
48
50
@@ -314,7 +316,14 @@ func (client *Client) doRequest(req *http.Request, response interface{}) error {
314
316
return & DisabledError {reason : "request not sent due to protocol violation" }
315
317
}
316
318
317
- resp , err := client .client .Do (req )
319
+ var resp * http.Response
320
+ var err error
321
+
322
+ if req .Method == "GET" {
323
+ resp , err = client .getClient .Do (req )
324
+ } else {
325
+ resp , err = client .postClient .Do (req )
326
+ }
318
327
if err != nil {
319
328
return err
320
329
}
You can’t perform that action at this time.
0 commit comments