chore: default to port 8000
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
use std::{env, process::ExitCode, time::Duration};
|
||||
|
||||
const DEFAULT_BASE_URL: &str = "http://localhost:5000";
|
||||
const DEFAULT_BASE_URL: &str = "http://localhost:8000";
|
||||
const REQUEST_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
#[tokio::main]
|
||||
@@ -166,7 +166,7 @@ fn trim_base_url(base_url: &str) -> String {
|
||||
}
|
||||
|
||||
const fn usage() -> &'static str {
|
||||
"Usage:\n pokedex-cli [--base-url URL] health\n pokedex-cli [--base-url URL] metrics\n pokedex-cli [--base-url URL] pokemon <name>\n pokedex-cli [--base-url URL] translated <name>\n\nExamples:\n pokedex-cli pokemon mewtwo\n pokedex-cli translated mewtwo\n pokedex-cli --base-url http://localhost:5000 pokemon pikachu"
|
||||
"Usage:\n pokedex-cli [--base-url URL] health\n pokedex-cli [--base-url URL] metrics\n pokedex-cli [--base-url URL] pokemon <name>\n pokedex-cli [--base-url URL] translated <name>\n\nExamples:\n pokedex-cli pokemon mewtwo\n pokedex-cli translated mewtwo\n pokedex-cli --base-url http://localhost:8000 pokemon pikachu"
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@@ -204,23 +204,23 @@ mod tests {
|
||||
}
|
||||
}
|
||||
);
|
||||
assert_eq!(args.url(), "http://localhost:5000/pokemon/mewtwo");
|
||||
assert_eq!(args.url(), "http://localhost:8000/pokemon/mewtwo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_custom_base_url_and_translated_command() {
|
||||
let args = parse_args([
|
||||
"--base-url",
|
||||
"http://localhost:5000/",
|
||||
"http://localhost:8000/",
|
||||
"translated",
|
||||
"mr-mime",
|
||||
])
|
||||
.expect("args should parse");
|
||||
|
||||
assert_eq!(args.base_url, "http://localhost:5000");
|
||||
assert_eq!(args.base_url, "http://localhost:8000");
|
||||
assert_eq!(
|
||||
args.url(),
|
||||
"http://localhost:5000/pokemon/translated/mr-mime"
|
||||
"http://localhost:8000/pokemon/translated/mr-mime"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user