aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-08-25 13:46:12 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-25 13:46:12 -0700
commitc49b85ffa31016be21f03e484a263c36932fefe0 (patch)
tree236b09eb29b004b524b69096662c4556bf8c3d53 /src/main.rs
parentcbcb4d8c9fc1ec276e6b67abb7ee5de3b3ac0fbb (diff)
downloades-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.rs5
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()
},
};