Skip to main content

fetch_discovery

Function fetch_discovery 

Source
pub async fn fetch_discovery(
    host: &Url,
    client: &Client,
) -> Result<Discovery, Error>
Available on crate feature client only.
Expand description

Fetches the /.well-known/nodeinfo discovery document from host, enforcing DEFAULT_MAX_BODY_BYTES as the body size cap.

host should be a full base URL (including scheme), e.g. https://mastodon.social. Pass a client obtained from recommended_client to also benefit from the same-origin redirect policy.

ยงErrors

Returns Error::InvalidUrl if host cannot be joined with the well-known path, Error::Http for network failures, Error::BadStatus for non-2xx responses, Error::ResponseTooLarge when the body exceeds the cap, and Error::Json if the body is not valid JSON.