1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

fix: add timeout setting for default http client

This commit is contained in:
Mrs4s 2023-03-18 10:35:19 +08:00
parent 4ad7da7a9a
commit 174d99f94b
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7

View File

@ -12,6 +12,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"time"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
@ -32,6 +33,7 @@ var client = &http.Client{
MaxIdleConns: 0, MaxIdleConns: 0,
MaxIdleConnsPerHost: 999, MaxIdleConnsPerHost: 999,
}, },
Timeout: time.Second * 5,
} }
// ErrOverSize 响应主体过大时返回此错误 // ErrOverSize 响应主体过大时返回此错误