From 7839b9501066108cb2322ba9039120a41781a1b0 Mon Sep 17 00:00:00 2001 From: John Martin Date: Mon, 4 Nov 2024 14:39:56 -0800 Subject: [PATCH] add client-request-method to CORS allowed headers (#20160) (#20168) ## Description adds `client-request-method` to allowed cors methods ## Test plan --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API: ## Description Describe the changes or additions included in this PR. ## Test plan How did you test the new or updated feature? --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API: --- crates/sui-json-rpc-api/src/lib.rs | 1 + crates/sui-json-rpc/src/lib.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/sui-json-rpc-api/src/lib.rs b/crates/sui-json-rpc-api/src/lib.rs index 4e7072c73f07e..3f14c38516083 100644 --- a/crates/sui-json-rpc-api/src/lib.rs +++ b/crates/sui-json-rpc-api/src/lib.rs @@ -337,6 +337,7 @@ pub fn read_size_from_env(var_name: &str) -> Option { .ok() } +pub const CLIENT_REQUEST_METHOD_HEADER: &str = "client-request-method"; pub const CLIENT_SDK_TYPE_HEADER: &str = "client-sdk-type"; /// The version number of the SDK itself. This can be different from the API version. pub const CLIENT_SDK_VERSION_HEADER: &str = "client-sdk-version"; diff --git a/crates/sui-json-rpc/src/lib.rs b/crates/sui-json-rpc/src/lib.rs index 3075471af9d1b..d9704bbcef767 100644 --- a/crates/sui-json-rpc/src/lib.rs +++ b/crates/sui-json-rpc/src/lib.rs @@ -25,7 +25,8 @@ pub use balance_changes::*; pub use object_changes::*; pub use sui_config::node::ServerType; use sui_json_rpc_api::{ - CLIENT_SDK_TYPE_HEADER, CLIENT_SDK_VERSION_HEADER, CLIENT_TARGET_API_VERSION_HEADER, + CLIENT_REQUEST_METHOD_HEADER, CLIENT_SDK_TYPE_HEADER, CLIENT_SDK_VERSION_HEADER, + CLIENT_TARGET_API_VERSION_HEADER, }; use sui_open_rpc::{Module, Project}; @@ -121,6 +122,7 @@ impl JsonRpcServerBuilder { HeaderName::from_static(CLIENT_SDK_VERSION_HEADER), HeaderName::from_static(CLIENT_TARGET_API_VERSION_HEADER), HeaderName::from_static(APP_NAME_HEADER), + HeaderName::from_static(CLIENT_REQUEST_METHOD_HEADER), ]); Ok(cors) }