Skip to content

Commit a0d719f

Browse files
authored
feat: add graph-indexed header in subgraph query response (#522)
Fixes #494
1 parent ed4721d commit a0d719f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/service/src/routes/request_handler.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use thegraph_core::DeploymentId;
1212
use tracing::trace;
1313

1414
const GRAPH_ATTESTABLE: &str = "graph-attestable";
15+
const GRAPH_INDEXED: &str = "graph-indexed";
1516

1617
pub async fn request_handler(
1718
Path(deployment): Path<DeploymentId>,
@@ -41,6 +42,7 @@ pub async fn request_handler(
4142
value.to_str().map(|value| value == "true").unwrap_or(false)
4243
});
4344

45+
let graph_indexed = response.headers().get(GRAPH_INDEXED).cloned();
4446
let body = response
4547
.text()
4648
.await
@@ -54,5 +56,9 @@ pub async fn request_handler(
5456
let mut response = Response::new(body);
5557
response.extensions_mut().insert(attestation_input);
5658

59+
if let Some(graph_indexed) = graph_indexed {
60+
response.headers_mut().append(GRAPH_INDEXED, graph_indexed);
61+
}
62+
5763
Ok(response)
5864
}

0 commit comments

Comments
 (0)