diff --git a/crates/sui-graphql-rpc/src/extensions/query_limits_checker.rs b/crates/sui-graphql-rpc/src/extensions/query_limits_checker.rs index 9f9f731c90880..6159cd8405c8b 100644 --- a/crates/sui-graphql-rpc/src/extensions/query_limits_checker.rs +++ b/crates/sui-graphql-rpc/src/extensions/query_limits_checker.rs @@ -12,9 +12,7 @@ use async_graphql::parser::types::{ }; use async_graphql::{value, Name, Pos, Positioned, Response, ServerResult, Value, Variables}; use async_graphql_value::Value as GqlValue; -use axum::headers; use axum::http::HeaderName; -use axum::http::HeaderValue; use once_cell::sync::Lazy; use std::collections::{BTreeSet, HashMap, VecDeque}; use std::net::SocketAddr; @@ -48,21 +46,10 @@ struct QueryLimitsCheckerExt { pub(crate) const CONNECTION_FIELDS: [&str; 2] = ["edges", "nodes"]; -impl headers::Header for ShowUsage { - fn name() -> &'static HeaderName { +impl ShowUsage { + pub(crate) fn name() -> &'static HeaderName { &LIMITS_HEADER } - - fn decode<'i, I>(_: &mut I) -> Result - where - I: Iterator, - { - Ok(ShowUsage) - } - - fn encode>(&self, _: &mut E) { - unimplemented!() - } } impl ExtensionFactory for QueryLimitsChecker { diff --git a/crates/sui-graphql-rpc/src/server/builder.rs b/crates/sui-graphql-rpc/src/server/builder.rs index f2ef3f408567b..c2429bac1f41d 100644 --- a/crates/sui-graphql-rpc/src/server/builder.rs +++ b/crates/sui-graphql-rpc/src/server/builder.rs @@ -44,7 +44,7 @@ use axum::middleware::{self}; use axum::response::IntoResponse; use axum::routing::{get, post, MethodRouter, Route}; use axum::Extension; -use axum::{headers::Header, Router}; +use axum::Router; use chrono::Utc; use http::{HeaderValue, Method, Request}; use hyper::server::conn::AddrIncoming as HyperAddrIncoming; @@ -57,7 +57,7 @@ use std::net::TcpStream; use std::sync::Arc; use std::time::Duration; use std::{any::Any, net::SocketAddr, time::Instant}; -use sui_graphql_rpc_headers::{LIMITS_HEADER, VERSION_HEADER}; +use sui_graphql_rpc_headers::LIMITS_HEADER; use sui_package_resolver::{PackageStoreWithLruCache, Resolver}; use sui_sdk::SuiClientBuilder; use tokio::join; @@ -309,11 +309,7 @@ impl ServerBuilder { .allow_methods([Method::POST]) // Allow requests from any origin .allow_origin(acl) - .allow_headers([ - hyper::header::CONTENT_TYPE, - VERSION_HEADER.clone(), - LIMITS_HEADER.clone(), - ]); + .allow_headers([hyper::header::CONTENT_TYPE, LIMITS_HEADER.clone()]); Ok(cors) }