pub struct HeaderBuilder { /* private fields */ }Implementations§
Source§impl HeaderBuilder
impl HeaderBuilder
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn header(&mut self, key: HeaderName, value: HeaderValue) -> &mut Self
pub fn header_static( &mut self, key: HeaderName, value: &'static str, ) -> &mut Self
pub fn header_str( &mut self, key: HeaderName, value: &str, ) -> Result<&mut Self, HeaderError>
pub fn append( &mut self, key: HeaderName, value: HeaderValue, ) -> Result<&mut Self, Error>
Sourcepub fn client_id(&mut self, id: &str) -> Result<&mut Self, HeaderError>
pub fn client_id(&mut self, id: &str) -> Result<&mut Self, HeaderError>
Client-Id:
Sourcepub fn user_agent(&mut self, agent: &str) -> Result<&mut Self, HeaderError>
pub fn user_agent(&mut self, agent: &str) -> Result<&mut Self, HeaderError>
User-Agent:
Sourcepub fn cache_control_no_cache(&mut self) -> &mut Self
pub fn cache_control_no_cache(&mut self) -> &mut Self
Cache-Control: no-cache
Sourcepub fn cache_control(&mut self, value: &str) -> Result<&mut Self, HeaderError>
pub fn cache_control(&mut self, value: &str) -> Result<&mut Self, HeaderError>
Cache-Control:
Sourcepub fn api_key(&mut self, key: &str) -> Result<&mut Self, HeaderError>
pub fn api_key(&mut self, key: &str) -> Result<&mut Self, HeaderError>
X-API-Key:
Sourcepub fn request_id(&mut self, id: &str) -> Result<&mut Self, HeaderError>
pub fn request_id(&mut self, id: &str) -> Result<&mut Self, HeaderError>
X-Request-ID:
Sourcepub fn origin(&mut self, origin: &str) -> Result<&mut Self, HeaderError>
pub fn origin(&mut self, origin: &str) -> Result<&mut Self, HeaderError>
Origin:
Sourcepub fn referer(&mut self, referer: &str) -> Result<&mut Self, HeaderError>
pub fn referer(&mut self, referer: &str) -> Result<&mut Self, HeaderError>
Referer:
Sourcepub fn cors_allow_all(&mut self) -> &mut Self
pub fn cors_allow_all(&mut self) -> &mut Self
Access-Control-Allow-Origin: *
Sourcepub fn cors_allow_origin(
&mut self,
origin: &str,
) -> Result<&mut Self, HeaderError>
pub fn cors_allow_origin( &mut self, origin: &str, ) -> Result<&mut Self, HeaderError>
Access-Control-Allow-Origin:
Sourcepub fn cors_allow_methods_standard(&mut self) -> &mut Self
pub fn cors_allow_methods_standard(&mut self) -> &mut Self
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Sourcepub fn cors_allow_headers_standard(&mut self) -> &mut Self
pub fn cors_allow_headers_standard(&mut self) -> &mut Self
Access-Control-Allow-Headers: Content-Type, Authorization
Sourcepub fn connection_keep_alive(&mut self) -> &mut Self
pub fn connection_keep_alive(&mut self) -> &mut Self
Connection: keep-alive
Sourcepub fn connection_close(&mut self) -> &mut Self
pub fn connection_close(&mut self) -> &mut Self
Connection: close
Sourcepub fn content_length(&mut self, length: u64) -> &mut Self
pub fn content_length(&mut self, length: u64) -> &mut Self
Content-Length:
Sourcepub fn json_api(&mut self) -> &mut Self
pub fn json_api(&mut self) -> &mut Self
Accept: application/json, Content-Type: application/json
pub fn build(self) -> HeaderMap
Source§impl HeaderBuilder
impl HeaderBuilder
Sourcepub fn accept_json(&mut self) -> &mut Self
pub fn accept_json(&mut self) -> &mut Self
ACCEPT: application/json
Sourcepub fn accept_html(&mut self) -> &mut Self
pub fn accept_html(&mut self) -> &mut Self
ACCEPT: text/html
Sourcepub fn accept_text(&mut self) -> &mut Self
pub fn accept_text(&mut self) -> &mut Self
ACCEPT: text/plain
Sourcepub fn accept_any(&mut self) -> &mut Self
pub fn accept_any(&mut self) -> &mut Self
ACCEPT: /
Sourcepub fn accept_mulity(
&mut self,
items: &[&str],
) -> Result<&mut Self, HeaderError>
pub fn accept_mulity( &mut self, items: &[&str], ) -> Result<&mut Self, HeaderError>
ACCEPT: multi items
Sourcepub fn accept_encoding_standard(&mut self) -> &mut Self
pub fn accept_encoding_standard(&mut self) -> &mut Self
Accept-Encoding: gzip, deflate, br
Sourcepub fn accept_language_en(&mut self) -> &mut Self
pub fn accept_language_en(&mut self) -> &mut Self
Accept-Language: en-US, en;q=0.9
Sourcepub fn accept_language(&mut self, lang: &str) -> Result<&mut Self, HeaderError>
pub fn accept_language(&mut self, lang: &str) -> Result<&mut Self, HeaderError>
Accept-Language:
Source§impl HeaderBuilder
impl HeaderBuilder
Sourcepub fn content_type_formencoded(&mut self) -> &mut Self
pub fn content_type_formencoded(&mut self) -> &mut Self
CONTENT-TYPE: application/x-www-form-urlencoded
Sourcepub fn content_type_json(&mut self) -> &mut Self
pub fn content_type_json(&mut self) -> &mut Self
CONTENT-TYPE: application/json
Sourcepub fn content_type_text(&mut self) -> &mut Self
pub fn content_type_text(&mut self) -> &mut Self
CONTENT-TYPE: text/plain
Sourcepub fn content_type_html(&mut self) -> &mut Self
pub fn content_type_html(&mut self) -> &mut Self
CONTENT-TYPE: text/html
Sourcepub fn content_type_multipart(&mut self) -> &mut Self
pub fn content_type_multipart(&mut self) -> &mut Self
CONTENT-TYPE: multipart/form-data
Source§impl HeaderBuilder
impl HeaderBuilder
Authorization:
pub fn basic_auth(&mut self, username: &str, password: &str) -> &mut Self
pub fn bearer_token(&mut self, token: &str) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HeaderBuilder
impl RefUnwindSafe for HeaderBuilder
impl Send for HeaderBuilder
impl Sync for HeaderBuilder
impl Unpin for HeaderBuilder
impl UnwindSafe for HeaderBuilder
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