chore(grequests): update grequests to v2
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/deploy Pipeline was successful

This commit is contained in:
Tom Neuber 2025-06-28 19:36:10 +02:00
parent a88da88a47
commit 00bf1820f1
Signed by: tom
GPG key ID: F17EFE4272D89FF6
5 changed files with 18 additions and 13 deletions

View file

@ -1,13 +1,14 @@
package downloader
import (
"context"
"errors"
"io"
"net/http"
"os"
"strings"
req "github.com/levigross/grequests"
req "github.com/levigross/grequests/v2"
"github.com/schollz/progressbar/v3"
)
@ -29,8 +30,8 @@ func NewContext(filename, link string) *Context {
}
}
func (c *Context) Download() error {
resp, err := req.Head(c.Link, nil)
func (c *Context) Download(ctx context.Context) error {
resp, err := req.Head(ctx, c.Link)
if err != nil {
if strings.Contains(err.Error(), "no such host") {
return ErrInvalidURL
@ -54,7 +55,7 @@ func (c *Context) Download() error {
return errors.New(resp.RawResponse.Status)
}
resp, err = req.Get(c.Link, nil)
resp, err = req.Get(ctx, c.Link)
if err != nil {
return err
}