[ 
https://issues.apache.org/jira/browse/DTACLOUD-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053856#comment-13053856
 ] 

Tomas Von Veschler commented on DTACLOUD-53:
--------------------------------------------

A curious finding, if I use the same User-Agent as Chrome, the content of the 
response changes:

$ curl --url http://192.168.0.194/api/hardware_profiles --show-error --header 
"Accept: application/json" -s -v --header "User-Agent:Mozilla/5.0 (X11; Linux 
x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.74" 2>&1 | egrep 
'(Accept|Content-Type)'
> Accept: application/json
< Content-Type: text/html;charset=utf-8

This is also preventing XMLHttpRequest calls from Chrome to work, while it's 
working on Firefox.

> 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

        

Reply via email to