@@ -34,14 +34,13 @@ impl Client {
34
34
///
35
35
/// Will return an error if the HTTP request fails.
36
36
pub async fn whitelist_torrent ( & self , info_hash : & str ) -> Result < Response , Error > {
37
- let request_url = format ! (
38
- "{}/whitelist/{}?token={}" ,
39
- self . base_url, info_hash, self . connection_info. token
40
- ) ;
37
+ let request_url = format ! ( "{}/whitelist/{}" , self . base_url, info_hash) ;
41
38
42
39
let client = reqwest:: Client :: new ( ) ;
43
40
44
- client. post ( request_url) . send ( ) . await
41
+ let params = [ ( "token" , & self . connection_info . token ) ] ;
42
+
43
+ client. post ( request_url) . query ( & params) . send ( ) . await
45
44
}
46
45
47
46
/// Remove a torrent from the tracker whitelist.
@@ -50,14 +49,13 @@ impl Client {
50
49
///
51
50
/// Will return an error if the HTTP request fails.
52
51
pub async fn remove_torrent_from_whitelist ( & self , info_hash : & str ) -> Result < Response , Error > {
53
- let request_url = format ! (
54
- "{}/whitelist/{}?token={}" ,
55
- self . base_url, info_hash, self . connection_info. token
56
- ) ;
52
+ let request_url = format ! ( "{}/whitelist/{}" , self . base_url, info_hash) ;
57
53
58
54
let client = reqwest:: Client :: new ( ) ;
59
55
60
- client. delete ( request_url) . send ( ) . await
56
+ let params = [ ( "token" , & self . connection_info . token ) ] ;
57
+
58
+ client. delete ( request_url) . query ( & params) . send ( ) . await
61
59
}
62
60
63
61
/// Retrieve a new tracker key.
@@ -66,14 +64,13 @@ impl Client {
66
64
///
67
65
/// Will return an error if the HTTP request fails.
68
66
pub async fn retrieve_new_tracker_key ( & self , token_valid_seconds : u64 ) -> Result < Response , Error > {
69
- let request_url = format ! (
70
- "{}/key/{}?token={}" ,
71
- self . base_url, token_valid_seconds, self . connection_info. token
72
- ) ;
67
+ let request_url = format ! ( "{}/key/{}" , self . base_url, token_valid_seconds) ;
73
68
74
69
let client = reqwest:: Client :: new ( ) ;
75
70
76
- client. post ( request_url) . send ( ) . await
71
+ let params = [ ( "token" , & self . connection_info . token ) ] ;
72
+
73
+ client. post ( request_url) . query ( & params) . send ( ) . await
77
74
}
78
75
79
76
/// Retrieve the info for a torrent.
@@ -82,10 +79,12 @@ impl Client {
82
79
///
83
80
/// Will return an error if the HTTP request fails.
84
81
pub async fn get_torrent_info ( & self , info_hash : & str ) -> Result < Response , Error > {
85
- let request_url = format ! ( "{}/torrent/{}?token={} " , self . base_url, info_hash, self . connection_info . token ) ;
82
+ let request_url = format ! ( "{}/torrent/{}" , self . base_url, info_hash) ;
86
83
87
84
let client = reqwest:: Client :: new ( ) ;
88
85
89
- client. get ( request_url) . send ( ) . await
86
+ let params = [ ( "token" , & self . connection_info . token ) ] ;
87
+
88
+ client. get ( request_url) . query ( & params) . send ( ) . await
90
89
}
91
90
}
0 commit comments