diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-08-25 13:46:12 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-08-25 13:46:12 -0700 |
commit | c49b85ffa31016be21f03e484a263c36932fefe0 (patch) | |
tree | 236b09eb29b004b524b69096662c4556bf8c3d53 /src/main.rs | |
parent | cbcb4d8c9fc1ec276e6b67abb7ee5de3b3ac0fbb (diff) | |
download | es-public-proxy-c49b85ffa31016be21f03e484a263c36932fefe0.tar.gz es-public-proxy-c49b85ffa31016be21f03e484a263c36932fefe0.zip |
return JSON error body
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 5e6c20c..2b25f32 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,8 +17,9 @@ async fn upstream_req(req: Request<Body>, config: ProxyConfig) -> Result<Respons } Err(other) => { Response::builder() - .status(StatusCode::NOT_FOUND) - .body(format!("oh noooo! {:?}", other).into()) + .status(StatusCode::INTERNAL_SERVER_ERROR) + .header("Content-Type", "application/json; charset=UTF-8") + .body(serde_json::to_string(&other.to_json()).unwrap().into()) .unwrap() }, }; |