fix: 调整POST/PUT请求超时10s

This commit is contained in:
TsMask
2024-09-20 17:22:27 +08:00
parent 845d8453ed
commit 877e45ccb2
2 changed files with 3 additions and 3 deletions

View File

@@ -87,7 +87,7 @@ func Post(url string, data url.Values, headers map[string]string) ([]byte, error
// PostJSON 发送 POST 请求,并将请求体序列化为 JSON 格式
func PostJSON(url string, data any, headers map[string]string) ([]byte, error) {
client := &http.Client{
Timeout: 3 * time.Second, // 超时时间
Timeout: 10 * time.Second, // 超时时间
}
jsonData, err := json.Marshal(data)
@@ -180,7 +180,7 @@ func PostUploadFile(url string, params map[string]string, file *os.File) ([]byte
// PutJSON 发送 PUT 请求,并将请求体序列化为 JSON 格式
func PutJSON(url string, data any, headers map[string]string) ([]byte, error) {
client := &http.Client{
Timeout: 3 * time.Second, // 超时时间
Timeout: 10 * time.Second, // 超时时间
}
jsonData, err := json.Marshal(data)