couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filipe Manana (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1175) Improve content type negotiation for couchdb JSON responses
Date Tue, 21 Jun 2011 09:10:47 GMT


Filipe Manana commented on COUCHDB-1175:

Hi Jason,

The resulting list not only depends on the Q values but also on the order of the input given
to it (when Qs are equal) and the specificity of the types. The caller must give full types
as the parameter to the call. E.g.   Req:accepted_content_types(["text/html", "application/json"])

For that call, if the Accept header is ""text/*;q=0.8, */*;q=0.5"  it will return  ["text/html",
"application/json"], meaning the client prefers text/html and then application/json. When
the Accept header has both "type/subtype" and "type/*", it will give preference to type/subtype
if it matches any type given in the input list, example:

    Req9 = mochiweb_request:new(nil, 'GET', "/foo", {1, 1},
        mochiweb_headers:make([{"Accept", "text/*;q=0.9, text/html;q=0.5, */*;q=0.7"}])),
    ?assertEqual(["application/json", "text/html"],
        Req9:accepted_content_types(["text/html", "application/json"])).

I guess this is what you were concerned with?

> Improve content type negotiation for couchdb JSON responses
> -----------------------------------------------------------
>                 Key: COUCHDB-1175
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>    Affects Versions: 1.0.2
>            Reporter: Robert Newson
>            Assignee: Robert Newson
>            Priority: Blocker
>             Fix For: 1.1.1, 1.2
> Currently we ignore qvalues when negotiation between 'application/json' and 'text/plain'
when returning JSON responses.
> Specifically, we test directly for 'application/json' or 'text/plain' in the Accept header.
Different branches have different bugs, though. Trunk returns 'application/json' if 'application/json'
is present at all, even if it's less preferred than 'text/plain' when qvalues are accounted
> We should follow the standard.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message