#[non_exhaustive]pub struct Config {
pub base_url: Option<Url>,
pub headers: HashMap<HeaderName, HeaderValues>,
}
Expand description
Configuration for crux_http::Http
s and their underlying HTTP client.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.base_url: Option<Url>
The base URL for a client. All request URLs will be relative to this URL.
Note: a trailing slash is significant. Without it, the last path component is considered to be a “file” name to be removed to get at the “directory” that is used as the base.
headers: HashMap<HeaderName, HeaderValues>
Headers to be applied to every request made by this client.
Implementations§
source§impl Config
impl Config
sourcepub fn add_header(
self,
name: impl Into<HeaderName>,
values: impl ToHeaderValues
) -> Result<Self>
pub fn add_header( self, name: impl Into<HeaderName>, values: impl ToHeaderValues ) -> Result<Self>
Adds a header to be added to every request by this config.
Default: No extra headers.
sourcepub fn set_base_url(self, base: Url) -> Self
pub fn set_base_url(self, base: Url) -> Self
Sets the base URL for this config. All request URLs will be relative to this URL.
Note: a trailing slash is significant. Without it, the last path component is considered to be a “file” name to be removed to get at the “directory” that is used as the base.
Default: None
(internally).
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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