pub struct HttpRequestProducerConfig {
pub extract_body: bool,
pub max_body_size: Option<usize>,
pub parse_json: bool,
pub extract_query_params: bool,
pub extract_path_params: bool,
pub stream_body: bool,
pub chunk_size: usize,
}Expand description
Configuration for HTTP request producer behavior.
Fields§
§extract_body: boolWhether to extract the request body as bytes.
max_body_size: Option<usize>Maximum body size to extract (in bytes). None means no limit.
parse_json: boolWhether to parse JSON body automatically.
extract_query_params: boolWhether to extract query parameters.
extract_path_params: boolWhether to extract path parameters.
stream_body: boolWhether to stream the request body in chunks instead of loading it all at once. When enabled, the producer will yield the request metadata first, then stream body chunks. This is memory-efficient for large request bodies.
chunk_size: usizeChunk size for streaming (in bytes). Only used when stream_body is true.
Implementations§
Source§impl HttpRequestProducerConfig
impl HttpRequestProducerConfig
Sourcepub fn with_extract_body(self, extract: bool) -> Self
pub fn with_extract_body(self, extract: bool) -> Self
Sets whether to extract the request body.
Sourcepub fn with_max_body_size(self, size: Option<usize>) -> Self
pub fn with_max_body_size(self, size: Option<usize>) -> Self
Sets the maximum body size to extract.
Sourcepub fn with_parse_json(self, parse: bool) -> Self
pub fn with_parse_json(self, parse: bool) -> Self
Sets whether to parse JSON body automatically.
Sourcepub fn with_extract_query_params(self, extract: bool) -> Self
pub fn with_extract_query_params(self, extract: bool) -> Self
Sets whether to extract query parameters.
Sourcepub fn with_extract_path_params(self, extract: bool) -> Self
pub fn with_extract_path_params(self, extract: bool) -> Self
Sets whether to extract path parameters.
Sourcepub fn with_stream_body(self, stream: bool) -> Self
pub fn with_stream_body(self, stream: bool) -> Self
Sets whether to stream the request body in chunks.
When enabled, the producer will yield the request metadata first, then stream body chunks. This is memory-efficient for large request bodies.
§Example
use streamweave::http_server::HttpRequestProducerConfig;
let config = HttpRequestProducerConfig::default()
.with_stream_body(true)
.with_chunk_size(128 * 1024); // 128KB chunksSourcepub fn with_chunk_size(self, size: usize) -> Self
pub fn with_chunk_size(self, size: usize) -> Self
Sets the chunk size for streaming (in bytes).
Only used when stream_body is true. Default is 64KB.
Trait Implementations§
Source§impl Clone for HttpRequestProducerConfig
impl Clone for HttpRequestProducerConfig
Source§fn clone(&self) -> HttpRequestProducerConfig
fn clone(&self) -> HttpRequestProducerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more