1. Bitbucket
  2. Public Issue Tracker
  3. master
  4. Issues


Issue #7760 invalid

REST API: Event URI Has Changing Content-Type Header

created an issue

Within the past few days something has changed in the implementation of the event URI which causes the HTTP 'Content-Type' header to alternate from 'application/json' to 'text/html'. I believe it has something to do with a caching mechanism since it seems to report the correct Content-Type in a first request and subsequent requests return the 'text/html' Content-Type:

My first request to: https://api.bitbucket.org/1.0/users/thedillonb/events/ Returns: Content-Type →application/json; charset=utf-8

My second request to: https://api.bitbucket.org/1.0/users/thedillonb/events/ Returns: Content-Type →text/html; charset=utf-8

And will continue to return 'text/html' for a while.

The body is still JSON in both cases but the 'Content-Type' is incorrect in some cases.

Comments (9)

  1. Dillon reporter

    Here is an extended dump of the headers when I receive the 'text/html':

    Status Code: 200
    X-Version: 62739904b089
    Date: Sun, 14 Jul 2013 16:26:23 GMT
    Content-Encoding: gzip
    X-Content-Type-Options: nosniff
    X-Render-Time: 0.242606878281
    Strict-Transport-Security: max-age=2592000
    X-Static-Version: 9c918ff298bc
    Content-Length: 0
    X-Served-By: app09
    Server: nginx/1.2.4
    ETag: "bbd71b7d5fce8d7699c243da3c3bdec8"
    Vary: Accept-Language, Cookie
    Content-Language: en
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    X-Request-Count: 24

    Please notice that 'Content-Length' is also 0, effectivly truncating the data. While there is still the JSON data in the body, REST clients that abide by the 'Content-Length' will not return anything for data.

  2. Dillon reporter

    Hey Erik, I appreciate you looking into the issue. Fortunately, through my testing, I believe I've discovered what is occurring. Originally, I was using a few simple REST clients I downloaded inside Chome which were experiencing the issue I described above with the first request being "application/json" and the subsequent being "text/html" (I was authenticated and I was accessing: : https://api.bitbucket.org/1.0/users/thedillonb/events/ ). However, today I tried using curl and was unable to get it to fail as I had previously seen. That being said, I tend to trust curl over the other REST clients, so I'm not sure if having the cookies part of the request (which the Chome REST clients were sending and curl was not) was causing trouble but I could not get it to act as I had previously expected with curl.

    With that, I think this defect can be closed as invalid.

  3. Log in to comment