incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomas Von Veschler (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DTACLOUD-53) Wrong content type selected if multiple media types are supplied
Date Thu, 23 Jun 2011 11:50:47 GMT
Wrong content type selected if multiple media types are supplied
----------------------------------------------------------------

                 Key: DTACLOUD-53
                 URL: https://issues.apache.org/jira/browse/DTACLOUD-53
             Project: DeltaCloud
          Issue Type: Bug
          Components: Server
            Reporter: Tomas Von Veschler
            Assignee: David Lutterkort
            Priority: Minor


When setting the Accept header as for example: application/json, */* , seems that */* is picked
up and XML content is returned instead of JSON. This doesn't follow the HTTP RFC (http://tools.ietf.org/html/rfc2616#section-14.1):

Media ranges can be overridden by more specific media ranges or
   specific media types. If more than one media range applies to a given
   type, the most specific reference has precedence. For example,

       Accept: text/*, text/html, text/html;level=1, */*

   have the following precedence:

       1) text/html;level=1
       2) text/html
       3) text/*
       4) */*

How to test it:

$ curl --url http://192.168.0.194/api/hardware_profiles --show-error --header "Accept: application/json,
*/*" -s -v 2>&1 | egrep '(Accept|Content-Type)'
> Accept: application/json, */*
< Content-Type: application/xml;charset=utf-8

$ curl --url http://192.168.0.194/api/hardware_profiles --show-error --header "Accept: application/json"
-s -v 2>&1 | egrep '(Accept|Content-Type)'
> Accept: application/json
< Content-Type: application/json;charset=utf-8

This causes problems to all jQuery users, as it sends "Accept:application/json, text/javascript,
*/*"

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message