-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
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:
- Set the browser address to http://explorer.cancerregulome.org/all_pairs/?dataset=brca_pw_manuscript
- Open the web console developer tool.
- 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.