diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/service.rs | 7 |
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 | " |
24 | This URL shortening services is powered by hedge. | 24 | This URL shortening service is powered by hedge. |
25 | 25 | ||
26 | github.com/nerdypepper/hedge | 26 | github.com/nerdypepper/hedge |
27 | 27 | ||
28 | To shorten urls: | 28 | To 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 | ||
39 | fn respond_with_shortlink<S: AsRef<[u8]>>(shortlink: S, host: &[u8]) -> Response<Body> { | 38 | fn 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) |