Skip to content

Wrong quality ranking when q parameter is not a floatΒ #2476

@ericproulx

Description

@ericproulx

I've noticed that processing application/json;q=invalid,application/xml;q=0.5 would set the Grape::Env::API_FORMAT to xml when it should be json. Unfortunately, the RFC isn't clear when q is not a float. Nonetheless the default value is 1.0 and Rack applies it when q is not a float.

My recommendation would be to follow Rack's implementation an probably use its best_q_match function instead of our own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions