Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add graph-indexed header in subgraph query response #522

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/service/src/routes/request_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use thegraph_core::DeploymentId;
use tracing::trace;

const GRAPH_ATTESTABLE: &str = "graph-attestable";
const GRAPH_INDEXED: &str = "graph-indexed";

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

let graph_indexed = response.headers().get(GRAPH_INDEXED).cloned();
let body = response
.text()
.await
Expand All @@ -54,5 +56,9 @@ pub async fn request_handler(
let mut response = Response::new(body);
response.extensions_mut().insert(attestation_input);

if let Some(graph_indexed) = graph_indexed {
response.headers_mut().append(GRAPH_INDEXED, graph_indexed);
}

Ok(response)
}
Loading