Set as nopcloser to allow retries
This commit is contained in:
@@ -31,7 +31,10 @@ func (rd *RealDebrid) UnrestrictCheck(link string) (*Download, error) {
|
|||||||
data := url.Values{}
|
data := url.Values{}
|
||||||
data.Set("link", link)
|
data.Set("link", link)
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", "https://api.real-debrid.com/rest/1.0/unrestrict/check", bytes.NewBufferString(data.Encode()))
|
dataBytes := bytes.NewBufferString(data.Encode())
|
||||||
|
requestBody := io.NopCloser(dataBytes)
|
||||||
|
|
||||||
|
req, err := http.NewRequest("POST", "https://api.real-debrid.com/rest/1.0/unrestrict/check", requestBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rd.log.Errorf("Error when creating a unrestrict check request: %v", err)
|
rd.log.Errorf("Error when creating a unrestrict check request: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -66,7 +69,10 @@ func (rd *RealDebrid) UnrestrictLink(link string, checkFirstByte bool) (*Downloa
|
|||||||
data := url.Values{}
|
data := url.Values{}
|
||||||
data.Set("link", link)
|
data.Set("link", link)
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", "https://api.real-debrid.com/rest/1.0/unrestrict/link", bytes.NewBufferString(data.Encode()))
|
dataBytes := bytes.NewBufferString(data.Encode())
|
||||||
|
requestBody := io.NopCloser(dataBytes)
|
||||||
|
|
||||||
|
req, err := http.NewRequest("POST", "https://api.real-debrid.com/rest/1.0/unrestrict/link", requestBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rd.log.Errorf("Error when creating a unrestrict link request: %v", err)
|
rd.log.Errorf("Error when creating a unrestrict link request: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -214,8 +220,11 @@ func (rd *RealDebrid) SelectTorrentFiles(id string, files string) error {
|
|||||||
data := url.Values{}
|
data := url.Values{}
|
||||||
data.Set("files", files)
|
data.Set("files", files)
|
||||||
|
|
||||||
|
dataBytes := bytes.NewBufferString(data.Encode())
|
||||||
|
requestBody := io.NopCloser(dataBytes)
|
||||||
|
|
||||||
reqURL := fmt.Sprintf("https://api.real-debrid.com/rest/1.0/torrents/selectFiles/%s", id)
|
reqURL := fmt.Sprintf("https://api.real-debrid.com/rest/1.0/torrents/selectFiles/%s", id)
|
||||||
req, err := http.NewRequest("POST", reqURL, bytes.NewBufferString(data.Encode()))
|
req, err := http.NewRequest("POST", reqURL, requestBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rd.log.Errorf("Error when creating a select files request: %v", err)
|
rd.log.Errorf("Error when creating a select files request: %v", err)
|
||||||
return err
|
return err
|
||||||
@@ -262,9 +271,12 @@ func (rd *RealDebrid) AddMagnetHash(magnet string) (*MagnetResponse, error) {
|
|||||||
data := url.Values{}
|
data := url.Values{}
|
||||||
data.Set("magnet", fmt.Sprintf("magnet:?xt=urn:btih:%s", magnet))
|
data.Set("magnet", fmt.Sprintf("magnet:?xt=urn:btih:%s", magnet))
|
||||||
|
|
||||||
|
dataBytes := bytes.NewBufferString(data.Encode())
|
||||||
|
requestBody := io.NopCloser(dataBytes)
|
||||||
|
|
||||||
// Construct request URL
|
// Construct request URL
|
||||||
reqURL := "https://api.real-debrid.com/rest/1.0/torrents/addMagnet"
|
reqURL := "https://api.real-debrid.com/rest/1.0/torrents/addMagnet"
|
||||||
req, err := http.NewRequest("POST", reqURL, bytes.NewBufferString(data.Encode()))
|
req, err := http.NewRequest("POST", reqURL, requestBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rd.log.Errorf("Error when creating an add magnet request: %v", err)
|
rd.log.Errorf("Error when creating an add magnet request: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user