Libraries v5.0.0
    Preparing search index...

    Class ContentNegotiator

    Selects the appropriate serializer/deserializer for a request or response based on the Accept / Content-Type HTTP headers.

    JSON is registered by default. Additional handlers can be added with register() or via ServerBuilder.contentType().

    Index
    • Select the deserializer for an incoming Content-Type header.

      Returns null if the content type is not recognised; the server will respond with 415 Unsupported Media Type in that case.

      Parameters

      • OptionalcontentTypeHeader: string

      Returns ContentTypeHandler | null

    • Select the best response serializer for the given Accept header value.

      Returns null if no registered handler can satisfy the request; the server will respond with 406 Not Acceptable in that case.

      Parameters

      • OptionalacceptHeader: string

      Returns ContentTypeHandler | null