Skip to main content

negotiate_accept

Function negotiate_accept 

Source
pub fn negotiate_accept(
    header_value: Option<&HeaderValue>,
) -> Result<OutputFormat, HttpError>
Expand description

Negotiates the Accept header for the /conversion endpoint.

Returns OutputFormat::Oxa for Accept: application/vnd.oxa+json, OutputFormat::PandocNative for Accept: application/vnd.pandoc.native, OutputFormat::Html for Accept: text/html, and OutputFormat::Blocknote for the BlockNote MIMEs, application/*, */*, and missing Accept. Wildcards default to BlockNote for back-compat with pre-oxa clients. When Accept lists multiple types, the first whose bare MIME matches a supported value wins (case-insensitive); q=... is stripped.

ยงErrors

Returns HttpError::NotAcceptable if no acceptable MIME type found.