Struct jsonrpsee_http_client::HttpClientBuilder
source · pub struct HttpClientBuilder { /* private fields */ }
Expand description
Http Client Builder.
Examples
use jsonrpsee_http_client::{HttpClientBuilder, HeaderMap, HeaderValue};
#[tokio::main]
async fn main() {
// Build custom headers used for every submitted request.
let mut headers = HeaderMap::new();
headers.insert("Any-Header-You-Like", HeaderValue::from_static("42"));
// Build client
let client = HttpClientBuilder::default()
.set_headers(headers)
.build("http://localhost")
.unwrap();
// use client....
}
Implementations§
source§impl HttpClientBuilder
impl HttpClientBuilder
sourcepub fn max_request_body_size(self, size: u32) -> Self
pub fn max_request_body_size(self, size: u32) -> Self
Sets the maximum size of a request body in bytes (default is 10 MiB).
sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Set request timeout (default is 60 seconds).
sourcepub fn max_concurrent_requests(self, max: usize) -> Self
pub fn max_concurrent_requests(self, max: usize) -> Self
Set max concurrent requests.
sourcepub fn certificate_store(self, certificate_store: CertificateStore) -> Self
pub fn certificate_store(self, certificate_store: CertificateStore) -> Self
Set which certificate store to use.
sourcepub fn id_format(self, id_kind: IdKind) -> Self
pub fn id_format(self, id_kind: IdKind) -> Self
Configure the data type of the request object ID (default is number).
sourcepub fn set_max_logging_length(self, max: u32) -> Self
pub fn set_max_logging_length(self, max: u32) -> Self
Max length for logging for requests and responses in number characters.
Logs bigger than this limit will be truncated.
sourcepub fn set_headers(self, headers: HeaderMap) -> Self
pub fn set_headers(self, headers: HeaderMap) -> Self
Set a custom header passed to the server with every request (default is none).
The caller is responsible for checking that the headers do not conflict or are duplicated.
Trait Implementations§
source§impl Debug for HttpClientBuilder
impl Debug for HttpClientBuilder
Auto Trait Implementations§
impl RefUnwindSafe for HttpClientBuilder
impl Send for HttpClientBuilder
impl Sync for HttpClientBuilder
impl Unpin for HttpClientBuilder
impl UnwindSafe for HttpClientBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more