Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-23475

API requests with mixed case in the application/json Content-Type header result in 500 responses

XMLWordPrintable

      Issue Summary

      When making an API request that has some uppercase letters in the application/json Content-Type header (e.g. Application/JSON, or application/Json, etc), the request returns a 500 response.

      Steps to Reproduce

      1. Run an API call like the following to update the title of an open PR in a Bitbucket Cloud repo
        curl -u username:app_password --request PUT \
        --url 'https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/pullrequests/23' \
        --header 'Accept: application/json' \
        --header 'Content-Type: Application/JSON' \
        --data '{
        "title": "Updated PR title"
        }'
        

      Expected Results

      The request succeeds.

      Actual Results

      The request returns a 500 error with the message "Something went wrong".

      Workaround

      Use lowercase in the application/json Content-Type header:

      curl -u username:app_password --request PUT \
      --url 'https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/pullrequests/23' \
      --header 'Accept: application/json' \
      --header 'Content-Type: application/json' \
      --data '{
      "title": "Updated PR title"
      }'
      

              Unassigned Unassigned
              tboudale Theodora Boudale (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: