Read first event of pb file

This commit is contained in:
Dominik Werder
2021-07-08 18:45:06 +02:00
parent c92e266662
commit a771c37e03
4 changed files with 118 additions and 11 deletions

View File

@@ -669,10 +669,19 @@ pub async fn archapp_channel_info(req: Request<Body>, node_config: &NodeConfigCa
let url = Url::parse(&format!("dummy:{}", req.uri()))?;
let pairs = get_url_query_pairs(&url);
let channel = channel_from_pairs(&pairs)?;
let res = archapp_wrap::channel_info(&channel, node_config).await?;
let buf = serde_json::to_vec(&res)?;
let ret = response(StatusCode::OK)
.header(http::header::CONTENT_TYPE, APP_JSON)
.body(Body::from(buf))?;
Ok(ret)
match archapp_wrap::channel_info(&channel, node_config).await {
Ok(res) => {
let buf = serde_json::to_vec(&res)?;
let ret = response(StatusCode::OK)
.header(http::header::CONTENT_TYPE, APP_JSON)
.body(Body::from(buf))?;
Ok(ret)
}
Err(e) => {
let ret = response(StatusCode::INTERNAL_SERVER_ERROR)
.header(http::header::CONTENT_TYPE, "text/text")
.body(Body::from(format!("{:?}", e)))?;
Ok(ret)
}
}
}