pub struct HttpRequestBuilder<'a> { /* private fields */ }Implementations§
Source§impl<'a> HttpRequestBuilder<'a>
impl<'a> HttpRequestBuilder<'a>
Sourcepub fn header(self, name: &str, value: &str) -> Self
pub fn header(self, name: &str, value: &str) -> Self
Add a header using the existing chainable API.
Invalid input is reported by Self::send or
Self::send_stream. Use Self::try_header when validation should
happen immediately.
Sourcepub fn try_header(
self,
name: &str,
value: &str,
) -> Result<Self, HttpRequestBuilderError>
pub fn try_header( self, name: &str, value: &str, ) -> Result<Self, HttpRequestBuilderError>
Add a header and return validation errors instead of panicking.
header remains available for trusted, compile-time-known headers and
preserves the existing chainable API. Use this method for values that
originate outside the application, such as user configuration or an
RPC request.
Sourcepub fn header_raw<K, V>(self, key: K, value: V) -> Self
pub fn header_raw<K, V>(self, key: K, value: V) -> Self
Add a typed header using the existing chainable API.
Conversion failures are reported by Self::send or
Self::send_stream. Use Self::try_header_raw for immediate
validation.
Sourcepub fn try_header_raw<K, V>(
self,
key: K,
value: V,
) -> Result<Self, HttpRequestBuilderError>
pub fn try_header_raw<K, V>( self, key: K, value: V, ) -> Result<Self, HttpRequestBuilderError>
Add a typed header and preserve conversion errors for the caller.
pub fn range(self, start: u64, end: Option<u64>) -> Self
pub fn body<B: Into<Vec<u8>>>(self, body: B) -> Self
pub fn user_agent(self, ua: &str) -> Self
pub fn referer(self, referer: &str) -> Self
pub async fn send(self) -> Result<HttpResponse, String>
Sourcepub async fn send_stream(self) -> Result<HttpResponseStream, String>
pub async fn send_stream(self) -> Result<HttpResponseStream, String>
Send this request while keeping the response body incremental.