REST API Browser sending wrong Content-Type

XMLWordPrintable

    • Type: Bug
    • Resolution: Tracked Elsewhere
    • Priority: Low
    • None
    • Affects Version/s: 5.1.8, 6.0.3
    • Component/s: None
    • 5.01

      Hi,

      While I was trying JIRA's REST API Browser in Administration section of JIRA, I wanted to test adding 1 new comment to an existing issue, through the REST API.

      I've selected "Atlassian JIRA - Plugins - REST Plugin" on the top left select box and then clicked (had to click twice) on "/issue/{issueIdOrKey}/comment". Then, I tested to see first if the GET method will work and it did. After that, I tried to see if the POST method will work, providing the same issue id as in the GET method, not changing the default post data in the box ("body": "Lorem ipsum ..."). After I clicked the "Execute" button, I've got an html page as a response, basicaly saying:

      <p>
      <b>Cause: </b><br/>
      javax.ws.rs.WebApplicationException: java.lang.IllegalArgumentException: Error parsing media type ', application/xml'
      </p>

      I've opened up the "Developer Tools" (using Google Chrome) and switched to the "Network" tab, to see the request and this is what the request looked like (pay attention to "Content-Type" header field):

      Request URL:http://localhost:2990/jira/rest/api/2/issue/TP-1/comment
      Request Method:POST
      Status Code:500 Internal Server Error
      Request Headers view parsed
      POST /jira/rest/api/2/issue/TP-1/comment HTTP/1.1
      Host: localhost:2990
      Connection: keep-alive
      Content-Length: 285
      Accept: application/json, text/javascript, /; q=0.01
      Origin: http://localhost:2990
      X-Requested-With: XMLHttpRequest
      User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
      Content-Type: , application/xml
      Referer: http://localhost:2990/jira/plugins/servlet/restbrowser
      Accept-Encoding: gzip,deflate,sdch
      Accept-Language: en-US,en;q=0.8

      {
      "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
      "visibility":

      { "type": "role", "value": "Administrators" }

      }

      My version of JIRA is: v5.1.8#787-sha1:823790c but I'll test tomorrow if this issue is present in the latest jira 6.x too.

              Assignee:
              Unassigned
              Reporter:
              Mladen B
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: