Skip to content

Inconsistent responses across browsers #31

@rbkreisberg

Description

@rbkreisberg

The PrettyJsonRequest class used for the MongoDB Query handler is problematic.

In Firefox, the default setting for XHR's (Ajax requests) is to have the "Accept" header with value equal to "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8". This triggers the Tornado handler response to be written in the pretty html.

Google Chrome sets the "Accept" header to "/" by default. Ajax requests sent from Chrome and Safari do not trigger the PrettyJson write function.

Recreate bug for Firefox:

  1. Set the browser address to http://explorer.cancerregulome.org/all_pairs/?dataset=brca_pw_manuscript
  2. Open the web console developer tool.
  3. Paste the following into the console.
function reqListener () {
  console.log(this.responseText);
}
var url = 'http://explorer.cancerregulome.org/addama/services/datastores/dev_ffn_20140520/STAD/feature_matrix?_include=id&_include=label&source=CLIN&source=SAMP';
var oReq = new XMLHttpRequest();
oReq.onload = reqListener;
oReq.open("get", url, true);
oReq.send();

The response will either be in HTML.

Doing the same in Chrome will result in a JSON response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions