MCPcopy Create free account
hub / github.com/SeismicSystems/summit / create_cors_layer

Function create_cors_layer

rpc/src/builder.rs:83–114  ·  view source on GitHub ↗
(http_cors_domains: &str)

Source from the content-addressed store, hash-verified

81 pub fn with_max_request_body_size(mut self, max: u32) -> Self {
82 self.config = self.config.max_request_body_size(max);
83 self
84 }
85
86 pub fn with_max_response_body_size(mut self, max: u32) -> Self {
87 self.config = self.config.max_response_body_size(max);
88 self
89 }
90
91 pub fn with_cors(mut self, cors_domains: Option<String>) -> Self {
92 self.cors_domains = cors_domains;
93 self
94 }
95
96 /// Sets the per-request timeout. jsonrpsee takes the `max_connections`
97 /// permit before reading the HTTP body and has no body read deadline of its
98 /// own, so without a bound a slow or withheld body holds a permit
99 /// indefinitely and a few hundred such requests can deny all RPC. This caps
100 /// how long any single request may hold its permit, from accept through body
101 /// read and method dispatch.
102 pub fn with_request_timeout(mut self, timeout: Duration) -> Self {
103 self.request_timeout = timeout;
104 self
105 }
106
107 /// Limits the number of calls in a single JSON-RPC batch. jsonrpsee defaults
108 /// to unlimited, which lets one body-size-bounded request fan out into very
109 /// many (potentially expensive, finalizer-bound) method calls. `0` disables
110 /// batching entirely; any other value caps the batch at that many calls.
111 pub fn with_batch_limit(mut self, limit: u32) -> Self {
112 self.config = self
113 .config
114 .set_batch_request_config(batch_config_for(limit));
115 self
116 }
117

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected