function isPreconditionFailure() {
      // if-match
      const ifMatch = /** @type {string} */ (getRequestHeader(req, "if-match"));

      // A recipient MUST ignore If-Unmodified-Since if the request contains
      // an If-Match header field; the condition in If-Match is considered to
      // be a more accurate replacement for the condition in
      // If-Unmodified-Since, and the two are only combined for the sake of
      // interoperating with older intermediaries that might not implement If-Match.
      if (ifMatch) {
        const etag = getResponseHeader(res, "ETag");

        return (
          !etag ||
          (ifMatch !== "*" &&
            parseTokenList(ifMatch).every(
              (match) =>
                match !== etag &&
                match !== `W/${etag}` &&
                `W/${match}` !== etag,
            ))
        );
      }

      // if-unmodified-since
      const ifUnmodifiedSince =
        /** @type {string} */
        (getRequestHeader(req, "if-unmodified-since"));

      if (ifUnmodifiedSince) {
        const unmodifiedSince = parseHttpDate(ifUnmodifiedSince);

        // A recipient MUST ignore the If-Unmodified-Since header field if the
        // received field-value is not a valid HTTP-date.
        if (!Number.isNaN(unmodifiedSince)) {
          const lastModified = parseHttpDate(
            /** @type {string} */ (getResponseHeader(res, "Last-Modified")),
          );

          return Number.isNaN(lastModified) || lastModified > unmodifiedSince;
        }
      }

      return false;
    }
@returns {boolean} true when precondition failure, otherwise false