refactor(http): don't return 500 on reload error
This commit is contained in:
parent
d633820d19
commit
76fd9ea82e
10
src/http.rs
10
src/http.rs
@ -12,13 +12,9 @@ pub async fn serve(
|
|||||||
let path = request.uri().path().to_owned();
|
let path = request.uri().path().to_owned();
|
||||||
|
|
||||||
Ok(match (request.method(), path.as_str()) {
|
Ok(match (request.method(), path.as_str()) {
|
||||||
(&Method::POST, "/reload") => match reload(&state.lua, None) {
|
(&Method::POST, "/reload") => {
|
||||||
Ok(()) => Response::new(empty()),
|
Response::new(full(format!("{:#?}", reload(&state.lua, None))))
|
||||||
Err(error) => status_code_response(
|
}
|
||||||
StatusCode::INTERNAL_SERVER_ERROR,
|
|
||||||
full(format!("{error:?}")),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
|
|
||||||
(&Method::POST, "/eval" | "/exec") => {
|
(&Method::POST, "/eval" | "/exec") => {
|
||||||
let bytes = request.into_body().collect().await?.to_bytes();
|
let bytes = request.into_body().collect().await?.to_bytes();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user