Skip to main content

negotiate_results_format

Function negotiate_results_format 

Source
pub fn negotiate_results_format(
    accept: Option<&str>,
) -> Result<QueryResultsFormat, ApiError>
Expand description

Pick JSON, XML, CSV, or TSV from an Accept header; default JSON.

First acceptable entry wins; media-type parameters (q, profiles) are ignored. Wildcards map to a format we can actually produce: JSON for */* / application/*, CSV for text/*. An Accept that lists only media types we cannot produce is a client error (406 Not Acceptable), matching RDF4J and RFC 9110 ยง12.5.1.