Bug 1205473 - curl -v -X GET -H "Content-Type:application/json" should return JSON
Summary: curl -v -X GET -H "Content-Type:application/json" should return JSON
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Zanata
Classification: Retired
Component: Component-API
Version: development
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Damian Jansen
QA Contact: Zanata-QA Mailling List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-25 00:24 UTC by Ding-Yi Chen
Modified: 2015-03-26 06:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-26 06:14:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Ding-Yi Chen 2015-03-25 00:24:41 UTC
Description of problem:
Running 

curl -v -X GET -H "Content-Type:application/json" ${ZANATA_URL}rest/projects/p/${PRJ}/iterations/i/${VERSION}/r/${DOC}/translations/${LANG}

returns XML instead of JSON


Version-Release number of selected component (if applicable):
https://github.com/zanata/zanata-server/commit/9297d202c5b0a11690d85c7161a769936274ad6c
(3.6.1-SNAPSHOT)

How reproducible:
Always

Steps to Reproduce:
1. curl -v -X GET -H "Content-Type:application/json" ${ZANATA_URL}rest/projects/p/${PRJ}/iterations/i/${VERSION}/r/${DOC}/translations/${LANG}


Actual results:
XML format was returned

Expected results:
JSON should be returned

Additional info:

Comment 1 Ding-Yi Chen 2015-03-26 01:57:48 UTC
This bug was reproduced in both  Zanata 3.5.1 (git-server-3.5.1) and Zanata 3.6.0 (git-server-3.6.0) 

3.5.1:
curl -k -v -X GET -H "X-Auth-User:${ZANATA_USER}" -H "X-Auth-Token:${ZANATA_KEY}" -H "Content-Type:application/json" "https://fedora.zanata.org/rest/projects/p/ibus-chewing/iterations/i/master/r/ibus-chewing/translations/zh-TW"

3.6.0:
curl -k -v -X GET -H "X-Auth-User:${ZANATA_USER}" -H "X-Auth-Token:${ZANATA_KEY}" -H "Content-Type:application/json" "https://fedora.zanata.org/rest/projects/p/ibus-chewing/iterations/i/master/r/ibus-chewing/translations/zh-TW"

Comment 2 Sean Flanigan 2015-03-26 04:30:19 UTC
Patrick, given what you know about the (previous) raw rest tests for json, do you have any idea why they didn't pick up this bug?

Comment 3 Patrick Huang 2015-03-26 05:04:41 UTC
You need to use header Accept: application/json. Content-Type is for telling the server what your request payload is (in this case GET has none). This is not a bug

Comment 4 Sean Flanigan 2015-03-26 06:14:18 UTC
Of course!  Thanks, Patrick.


Note You need to log in before you can comment on or make changes to this bug.