feat: 调试开关打开时记录全部接口响应
This commit is contained in:
@@ -168,13 +168,16 @@ func fetchPublic(ctx context.Context, rawURL string) ([]byte, error) {
|
||||
req.Header.Set("Accept", "*/*")
|
||||
resp, err := publicHTTP.Do(req)
|
||||
if err != nil {
|
||||
debugHTTP(req, nil, nil, err)
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
buf, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
|
||||
if err != nil {
|
||||
debugHTTP(req, resp, nil, err)
|
||||
return nil, err
|
||||
}
|
||||
debugHTTP(req, resp, buf, nil)
|
||||
if resp.StatusCode >= 400 {
|
||||
return nil, fmt.Errorf("网站返回 %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user