You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by "Michal Fojtik (JIRA)" <ji...@apache.org> on 2011/07/01 13:12:31 UTC

[jira] [Resolved] (DTACLOUD-53) Wrong content type selected if multiple media types are supplied

     [ https://issues.apache.org/jira/browse/DTACLOUD-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michal Fojtik resolved DTACLOUD-53.
-----------------------------------

    Resolution: Fixed
      Assignee: Michal Fojtik  (was: David Lutterkort)

Fixed in https://svn.apache.org/repos/asf/incubator/deltacloud/trunk@1141469

> 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: Michal Fojtik
>            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