Fix wiki routing

This commit is contained in:
spikecodes 2021-03-17 21:40:55 -07:00
parent 0ce2d9054e
commit a81502dde1
No known key found for this signature in database
GPG key ID: 004CECFF9B463BCB
3 changed files with 27 additions and 16 deletions

View file

@ -55,14 +55,14 @@ fn request(url: String) -> Boxed<Result<Response<Body>, String>> {
let client: client::Client<_, hyper::Body> = client::Client::builder().build(https);
let builder = Request::builder()
.method("GET")
.uri(&url)
.header("User-Agent", format!("web:libreddit:{}", env!("CARGO_PKG_VERSION")))
.header("Host", "www.reddit.com")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Language", "en-US,en;q=0.5")
.header("Connection", "keep-alive")
.body(Body::empty());
.method("GET")
.uri(&url)
.header("User-Agent", format!("web:libreddit:{}", env!("CARGO_PKG_VERSION")))
.header("Host", "www.reddit.com")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.header("Accept-Language", "en-US,en;q=0.5")
.header("Connection", "keep-alive")
.body(Body::empty());
async move {
match builder {
@ -84,7 +84,7 @@ fn request(url: String) -> Boxed<Result<Response<Body>, String>> {
}
Err(e) => Err(e.to_string()),
},
Err(_) => Err("Post url contains non-ASCII characters".to_string())
Err(_) => Err("Post url contains non-ASCII characters".to_string()),
}
}
.boxed()