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

Snippets REST API gives incorrect Content-Type for JSONP request (BB-13633)

    XMLWordPrintable

Details

    Description

      Adding a callback parameter to the URL should change the Content-Type from application/json; charset=utf-8 to application/javascript; charset=utf-8

      You can test this using:

      curl -s -I https://api.bitbucket.org/2.0/snippets/dvdsmpsn/y6Eeg/?callback=xxx | grep "^Content-Type:"
      Content-Type: application/json; charset=utf-8
      

      This is wrong and should instead be Content-Type: application/javascript; charset=utf-8 like in most of your other REST APIs.

      Compare this to another (correctly working) REST API:

      Standard JSON call:

      curl -s -I 'https://api.bitbucket.org/1.0/repositories/dvdsmpsn/pii-viewer-for-google-analytics/issues?status=open&status=new'| grep "^Content-Type:"
      Content-Type: application/json; charset=utf-8
      

      JSONP call with callback parameter

      curl -s -I 'https://api.bitbucket.org/1.0/repositories/dvdsmpsn/pii-viewer-for-google-analytics/issues?callback=xxx&status=open&status=new'| grep "^Content-Type:"
      Content-Type: application/javascript; charset=utf-8
      

      Aside

      I'm building some lightweight Atlassian Connect add-ons, so this is holding things up somewhat.

      Here's the non-working Bitbucket Snippets macro (from the incorrect content-type):
      https://dvdsmpsn.atlassian.net/wiki/display/issues/Bitbucket+Snippets+Macro+for+Confluence+Cloud

      Attachments

        Activity

          People

            6995b9ed1710 evzijst
            2eaf001e0aec David at David Simpson Apps
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: