Skip to content

Commit

Permalink
add client-request-method to CORS allowed headers (#20160) (#20168)
Browse files Browse the repository at this point in the history
## 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:
  • Loading branch information
johnjmartin authored Nov 4, 2024
1 parent ecffa45 commit 7839b95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/sui-json-rpc-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ pub fn read_size_from_env(var_name: &str) -> Option<usize> {
.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";
Expand Down
4 changes: 3 additions & 1 deletion crates/sui-json-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 7839b95

Please sign in to comment.