xmpp-httpx - v0.11.0
    Preparing search index...

    Function negotiateContentType

    • Chooses one of offered for the given Accept header, or undefined when nothing acceptable is on offer (the caller's cue for a 406).

      offered is in server preference order, which decides ties — so negotiateContentType(accept, ["text/html", "application/json"]) prefers HTML when a client says it takes either. An absent or empty header means "anything", answered with the server's first choice, as RFC 9110 allows.

      Parameters

      • header: string | null | undefined
      • offered: readonly string[]

      Returns string | undefined