File tree 3 files changed +6
-5
lines changed
3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " reddownload"
3
- version = " 0.2.2 "
3
+ version = " 0.2.3 "
4
4
edition = " 2021"
5
5
license = " MIT"
6
6
authors = [" Neil Bryson Cargamento <neilbrysonmc@gmail.com>" ]
Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ async fn main() -> Result<()> {
27
27
let args: Cli = Cli :: parse ( ) ;
28
28
let json_url = format ! ( "{}.json" , args. url) ;
29
29
let timeout = Duration :: new ( 20 , 0 ) ;
30
- let client = ClientBuilder :: new ( ) . timeout ( timeout) . build ( ) ?;
30
+ let client = ClientBuilder :: new ( )
31
+ . timeout ( timeout)
32
+ . user_agent ( USER_AGENT )
33
+ . build ( ) ?;
31
34
let check_url_response = client. head ( & json_url) . send ( ) . await ?;
32
35
33
36
return if check_url_response. status ( ) . is_success ( ) {
Original file line number Diff line number Diff line change 1
- use crate :: USER_AGENT ;
2
1
use anyhow:: { anyhow, Context , Result } ;
3
- use reqwest:: { header , Client } ;
2
+ use reqwest:: Client ;
4
3
use std:: fs;
5
4
use std:: io:: { copy, Cursor } ;
6
5
use std:: path:: { Path , PathBuf } ;
@@ -16,7 +15,6 @@ pub async fn download_file(
16
15
) -> Result < PathBuf > {
17
16
let response = client
18
17
. get ( url)
19
- . header ( header:: USER_AGENT , USER_AGENT )
20
18
. header ( "Content-Type" , content_type)
21
19
. send ( )
22
20
. await ?;
You can’t perform that action at this time.
0 commit comments