Skip to main content

render_profile

Function render_profile 

Source
pub fn render_profile(
    rec: &FrontDoorRecord,
    accept: &str,
) -> Result<QdpResponse, String>
Expand description

Render a FrontDoorRecord as a QDP profile, negotiating the representation from an HTTP Accept header value.

Matching is a simple substring test against accept (sufficient for the QDP media types):

  • contains "application/ld+json" → JSON-LD, content-type application/ld+json
  • else contains "application/cbor" → CBOR-LD, content-type application/cbor
  • else (default, incl. text/turtle and */*) → Turtle, content-type text/turtle

Returns Err only if serialization fails (JSON-LD or CBOR-LD encoding).