Skip to content

content negotiation accept header q values #34

@mvolkmann

Description

@mvolkmann

It would be nice if the content negotiation in Strata provided a way to get an ordered list of the media types a client accepts based on q values in the Accept header. For an example of a module that does this, see https://github.com/federomero/negotiator.

In this Accept header value ...

'text/json; q=0.1, text/plain; q=0.2, text/xml; q=0.3, text/html'

I would expect to get back

['text/html', 'text/xml', 'text/plain', 'text/json']

Media types with no q value, such as text/html in this example, default to 1.
Then they are sorted in descending order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions