mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-31 23:38:23 -04:00
Don't use contexts in the request directly
This commit is contained in:
parent
5ce59468bf
commit
47136d878b
1 changed files with 4 additions and 3 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -49,12 +50,12 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
|||
basePath := filepath.Base(dstPath)
|
||||
|
||||
for attempt := 1; attempt <= maxRetries; attempt++ {
|
||||
req, err := http.NewRequest("GET", downloadURL, nil)
|
||||
req := &http.Request{}
|
||||
parsedURL, err := url.Parse(downloadURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", "WiiUDownloader")
|
||||
req.URL = parsedURL
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue