Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-75936

/rest/api/2/mypreferences does not respect Accept and Content-Type headers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 9.9.0
    • REST API
    • None

    Description

      Issue Summary

      This is reproducible on Data Center: (yes)

      Currently when calling /rest/api/2/mypreferences?key=jira.user.locale endpoint, the results are sent and returned as a String regardless of the Accept: or Content-type: headers.

      Using Content-type: text/plain generates a HTTP 415 Unsupported Media Type response.

      Steps to Reproduce

      1. Using Jira 9.9.0 make a PUT request with
        curl --silent --verbose --user admin:admin --request PUT --url 'http://localhost:2990/jira/rest/api/2/mypreferences?key=jira.user.locale' --header 'Content-type: application/json' --data-raw 'en_AU'
        
      1. Make a GET request
        curl --silent --verbose --user admin:admin --request GET --url 'http://localhost:2990/jira/rest/api/2/mypreferences?key=jira.user.locale' --header 'Accept: application/json'
        

      Expected Results

      And error should be thrown because the PUT payload and the GET results should be in JSON format.

      Actual Results

      The PUT response has no error for a raw String payload

      HTTP/1.1 204
      ...
      Content-Type: application/json;charset=UTF-8
      

      and the GET request has the payload as a raw String even though we stated Accept: application/json.

      HTTP/1.1 200
      ...
      Content-Type: application/json;charset=UTF-8
      
      en_AU
      

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jrichards@atlassian.com James Richards
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: