Return-Path: X-Original-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F97C4D6A for ; Thu, 23 Jun 2011 11:51:09 +0000 (UTC) Received: (qmail 86855 invoked by uid 500); 23 Jun 2011 11:51:09 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 86823 invoked by uid 500); 23 Jun 2011 11:51:08 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 86815 invoked by uid 99); 23 Jun 2011 11:51:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jun 2011 11:51:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,NORMAL_HTTP_TO_IP,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jun 2011 11:51:07 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6645742B592 for ; Thu, 23 Jun 2011 11:50:47 +0000 (UTC) Date: Thu, 23 Jun 2011 11:50:47 +0000 (UTC) From: "Tomas Von Veschler (JIRA)" To: deltacloud-dev@incubator.apache.org Message-ID: <1255220761.33019.1308829847415.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (DTACLOUD-53) Wrong content type selected if multiple media types are supplied MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 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