aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/src/server.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-16 22:15:14 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-16 22:15:14 -0700
commitf3b2432664b28bd979d1600c2200e3fe41c8e380 (patch)
treeab7912f972deddfb35a1686b8a1dbddd03d78d7e /rust/fatcat-api/src/server.rs
parent2c9edb5c394d9fc75cf3be49a157763506e1265c (diff)
downloadfatcat-f3b2432664b28bd979d1600c2200e3fe41c8e380.tar.gz
fatcat-f3b2432664b28bd979d1600c2200e3fe41c8e380.zip
api tweaks
Diffstat (limited to 'rust/fatcat-api/src/server.rs')
-rw-r--r--rust/fatcat-api/src/server.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/rust/fatcat-api/src/server.rs b/rust/fatcat-api/src/server.rs
index 090c45e3..902ebd6d 100644
--- a/rust/fatcat-api/src/server.rs
+++ b/rust/fatcat-api/src/server.rs
@@ -759,11 +759,21 @@ where
match api.editgroup_id_get(param_id, context).wait() {
Ok(rsp) => match rsp {
- EditgroupIdGetResponse::FoundEditgroup(body) => {
+ EditgroupIdGetResponse::FoundEntity(body) => {
let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
let mut response = Response::with((status::Status::from_u16(200), body_string));
- response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_FOUND_EDITGROUP.clone()));
+ response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_FOUND_ENTITY.clone()));
+
+ context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
+
+ Ok(response)
+ }
+ EditgroupIdGetResponse::BadRequest(body) => {
+ let body_string = serde_json::to_string(&body).expect("impossible to fail to serialize");
+
+ let mut response = Response::with((status::Status::from_u16(400), body_string));
+ response.headers.set(ContentType(mimetypes::responses::EDITGROUP_ID_GET_BAD_REQUEST.clone()));
context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));