Struct lychee_lib::Client
source · pub struct Client { /* private fields */ }Expand description
Handles incoming requests and returns responses.
See ClientBuilder which contains sane defaults for all configuration
options.
Implementations§
source§impl Client
impl Client
sourcepub async fn check<T, E>(&self, request: T) -> Result<Response>
pub async fn check<T, E>(&self, request: T) -> Result<Response>
Check a single request.
request can be either a Request or a type that can be converted
into it. In any case, it must represent a valid URI.
§Errors
Returns an Err if:
requestdoes not represent a valid URI.- Encrypted connection for a HTTP URL is available but unused. (Only
checked when
Client::require_httpsistrue.)
sourcepub fn remap(&self, uri: &mut Uri) -> Result<()>
pub fn remap(&self, uri: &mut Uri) -> Result<()>
Remap uri using the client-defined remapping rules.
§Errors
Returns an Err if the final, remapped uri is not a valid URI.
sourcepub fn is_excluded(&self, uri: &Uri) -> bool
pub fn is_excluded(&self, uri: &Uri) -> bool
Returns whether the given uri should be ignored from checking.
sourcepub async fn check_website(
&self,
uri: &Uri,
credentials: &Option<BasicAuthCredentials>
) -> Result<Status>
pub async fn check_website( &self, uri: &Uri, credentials: &Option<BasicAuthCredentials> ) -> Result<Status>
Checks the given URI of a website.
§Errors
This returns an Err if
- The URI is invalid.
- The request failed.
- The response status code is not accepted.
- The URI cannot be converted to HTTPS.
sourcepub async fn check_website_inner(
&self,
uri: &Uri,
credentials: &Option<BasicAuthCredentials>
) -> Status
pub async fn check_website_inner( &self, uri: &Uri, credentials: &Option<BasicAuthCredentials> ) -> Status
Checks the given URI of a website.
Unsupported schemes will be ignored
§Errors
This returns an Err if
- The URI is invalid.
- The request failed.
- The response status code is not accepted.
sourcepub async fn check_file(&self, uri: &Uri) -> Status
pub async fn check_file(&self, uri: &Uri) -> Status
Check a file URI.
sourcepub async fn check_fragment(&self, path: &Path, uri: &Uri) -> Status
pub async fn check_fragment(&self, path: &Path, uri: &Uri) -> Status
Checks a file URI’s fragment.
sourcepub async fn check_mail(&self, uri: &Uri) -> Status
pub async fn check_mail(&self, uri: &Uri) -> Status
Check a mail address, or equivalently a mailto URI.
URIs may contain query parameters (e.g. contact@example.com?subject="Hello"),
which are ignored by this check. The are not part of the mail address
and instead passed to a mail client.