aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-08-24 11:10:50 +0100
committerAkshay <[email protected]>2020-08-24 11:10:50 +0100
commit4f83c8c353d25a1e2bf5c4859428bb2c3f1c04bb (patch)
treede4b58ec9443c1969f66c35d7c11a33118a5fcd8
parent9c71fb1a39964a8cb5696315c9a998a4872d7aab (diff)
fix minor inconveniences
-rw-r--r--src/service.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/service.rs b/src/service.rs
index b7b204c..6526d15 100644
--- a/src/service.rs
+++ b/src/service.rs
@@ -21,13 +21,12 @@ fn welcome(req: Request<Body>) -> Response<Body> {
21 let host = _h.as_ref().map(|h| h.as_bytes()).unwrap_or(b""); 21 let host = _h.as_ref().map(|h| h.as_bytes()).unwrap_or(b"");
22 let text = format!( 22 let text = format!(
23 " 23 "
24This URL shortening services is powered by hedge. 24This URL shortening service is powered by hedge.
25 25
26 github.com/nerdypepper/hedge 26 github.com/nerdypepper/hedge
27 27
28To shorten urls: 28To shorten urls:
29 curl -F'shorten=https://shorten.some/long/url' {} 29 curl -F'shorten=https://shorten.some/long/url' {}\n",
30 ",
31 String::from_utf8_lossy(host) 30 String::from_utf8_lossy(host)
32 ); 31 );
33 return Response::builder() 32 return Response::builder()
@@ -37,7 +36,7 @@ To shorten urls:
37} 36}
38 37
39fn respond_with_shortlink<S: AsRef<[u8]>>(shortlink: S, host: &[u8]) -> Response<Body> { 38fn respond_with_shortlink<S: AsRef<[u8]>>(shortlink: S, host: &[u8]) -> Response<Body> {
40 let url = [host, b"/", shortlink.as_ref()].concat(); 39 let url = [b"https://", host, b"/", shortlink.as_ref(), b"\n"].concat();
41 info!("Successfully generated shortlink"); 40 info!("Successfully generated shortlink");
42 Response::builder() 41 Response::builder()
43 .status(StatusCode::OK) 42 .status(StatusCode::OK)