fix: close response body in FetchHTMLDocument

This commit is contained in:
2026-06-11 11:25:51 +02:00
parent 7f98fbfa7a
commit f32bcf1288
2 changed files with 9 additions and 9 deletions

View File

@@ -346,7 +346,7 @@ func addCommonHeaders(request *http.Request) {
}
func fetchDocument(ctx context.Context, httpClient *http.Client, url string) (*goquery.Document, string, error) {
document, response, err := netutil.FetchHTMLDocument(ctx, httpClient, url, addCommonHeaders, func(response *http.Response, body []byte) error {
document, finalURL, err := netutil.FetchHTMLDocument(ctx, httpClient, url, addCommonHeaders, func(response *http.Response, body []byte) error {
return &HTTPStatusError{
StatusCode: response.StatusCode,
URL: url,
@@ -355,10 +355,10 @@ func fetchDocument(ctx context.Context, httpClient *http.Client, url string) (*g
}
})
if err != nil {
return nil, url, err
return nil, finalURL, err
}
return document, response.Request.URL.String(), nil
return document, finalURL, nil
}
type timetableAnimeAPI struct {