#[non_exhaustive]pub struct HttpCredentials {
pub username: String,
pub password: String,
pub origin: Option<String>,
pub send: Option<HttpCredentialsSend>,
}Expand description
Credentials for HTTP authentication.
A context can hold several: the first whose origin matches the request
is used, and an entry without an origin matches any request.
See: https://playwright.dev/docs/api/class-browser#browser-new-context-option-http-credentials
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.username: StringUsername to authenticate with.
password: StringPassword to authenticate with.
origin: Option<String>Restrict these credentials to one origin (scheme, host, and port,
e.g. https://example.com). Without it they match any request.
send: Option<HttpCredentialsSend>When to send the header. Defaults to after a 401, and only an
APIRequestContext honors
anything else; see HttpCredentialsSend.
Implementations§
Source§impl HttpCredentials
impl HttpCredentials
Sourcepub fn new(username: impl Into<String>, password: impl Into<String>) -> Self
pub fn new(username: impl Into<String>, password: impl Into<String>) -> Self
Credentials matching any origin.
Sourcepub fn origin(self, origin: impl Into<String>) -> Self
pub fn origin(self, origin: impl Into<String>) -> Self
Restrict these credentials to one origin.
Sourcepub fn send(self, send: HttpCredentialsSend) -> Self
pub fn send(self, send: HttpCredentialsSend) -> Self
Choose when the Authorization header is sent.
Trait Implementations§
Source§impl Clone for HttpCredentials
impl Clone for HttpCredentials
Source§fn clone(&self) -> HttpCredentials
fn clone(&self) -> HttpCredentials
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpCredentials
impl Debug for HttpCredentials
Source§impl<'de> Deserialize<'de> for HttpCredentials
impl<'de> Deserialize<'de> for HttpCredentials
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HttpCredentials
impl RefUnwindSafe for HttpCredentials
impl Send for HttpCredentials
impl Sync for HttpCredentials
impl Unpin for HttpCredentials
impl UnsafeUnpin for HttpCredentials
impl UnwindSafe for HttpCredentials
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