Function assertReadConditions

  • Verify whether the given Representation matches the given conditions. If true, add the corresponding ETag to the body metadata. If not, destroy the data stream and throw a NotModifiedHttpError with the same ETag. If conditions is not defined, nothing will happen.

    This uses the strict conditions check which takes the content type into account; therefore, this should only be called after content negotiation, when it is certain what the output will be.

    Note that browsers only keep track of one ETag, and the Vary header has no impact on this, meaning the browser could send us the ETag for a Turtle resource even though it is requesting JSON-LD; this is why we have to check ETags after content negotiation.


    • body: Representation

      The representation to compare the conditions against.

    • eTagHandler: ETagHandler

      Used to generate the ETag to return with the 304 response.

    • Optional conditions: Conditions

      The conditions to assert.

    Returns void