Skip to content

Commit

Permalink
fix(#57): malformed indexing status response (#58)
Browse files Browse the repository at this point in the history
* fix: allow status fields required by gateway

* fix: forward status response as JSON value
  • Loading branch information
Theodus authored Sep 28, 2023
1 parent 50fb34e commit cf21797
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions service/src/server/routes/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ lazy_static::lazy_static! {
static ref SUPPORTED_ROOT_FIELDS: HashSet<&'static str> =
vec![
"indexingStatuses",
"chains",
"latestBlock",
"earliestBlock",
"publicProofsOfIndexing",
"entityChangesInBlock",
"blockData",
Expand Down Expand Up @@ -61,13 +64,11 @@ pub async fn status_queries(
.body(Bytes::from(query_string))
.header(header::CONTENT_TYPE, "application/json");

let response: reqwest::Response = match request.send().await {
Ok(r) => r,
match request.send().await {
Ok(r) => match r.json::<Box<serde_json::value::RawValue>>().await {
Ok(r) => (StatusCode::OK, Json(r)).into_response(),
Err(e) => return bad_request_response(&e.to_string()),
},
Err(e) => return bad_request_response(&e.to_string()),
};

match response.text().await {
Ok(r) => (StatusCode::OK, Json(r)).into_response(),
_ => bad_request_response("Response from Graph node cannot be parsed as a string"),
}
}

0 comments on commit cf21797

Please sign in to comment.