Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GET method for admin logging endpoint #654

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ async fn handle_config_dump(
//mirror envoy's behavior: https://www.envoyproxy.io/docs/envoy/latest/operations/admin#post--logging
//NOTE: multiple query parameters is not supported, for example
//curl -X POST http://127.0.0.1:15000/logging?"tap=debug&router=debug"
//Also, add a GET endpoint since browsers send GET requests when visiting a site.
static HELP_STRING: &str = "
usage: GET /logging\t\t\t\t\t\t(To list current level)
usage: POST /logging\t\t\t\t\t\t(To list current level)
usage: POST /logging?level=<level>\t\t\t\t(To change global levels)
usage: POST /logging?level={mod1}:{level1},{mod2}:{level2}\t(To change specific mods' logging level)
Expand Down Expand Up @@ -337,6 +339,7 @@ async fn handle_logging(req: Request<Incoming>) -> Response<Full<Bytes>> {
list_loggers()
}
}
hyper::Method::GET => list_loggers(),
_ => plaintext_response(
hyper::StatusCode::METHOD_NOT_ALLOWED,
format!("Invalid HTTP method\n {HELP_STRING}"),
Expand Down