Permalink
Browse files

patch response headers ref for Chrome 60

  • Loading branch information...
nicksagona committed Aug 17, 2017
1 parent d38fdfb commit 5724a17d411bd8adb263487d00c8d72f73e7258f
Showing with 49 additions and 29 deletions.
  1. +24 −14 build/jax.5.5.0.js
  2. +2 −2 build/jax.5.5.0.min.js
  3. +23 −13 src/http/response.js
View
@@ -7,7 +7,7 @@
* @copyright Copyright (c) 2009-2017 NOLA Interactive, LLC. (http://www.nolainteractive.com)
* @license http://www.jaxjs.org/license New BSD License
* @version 5.5.0
* @build Jul 14, 2017 11:29:58
* @build Aug 17, 2017 14:33:24
*/
(function(window){
window.jax = {
@@ -327,19 +327,29 @@
// Detect application type
if (type == null) {
// Try from response object content type header
if ((response.headers != undefined) && (response.headers['Content-Type'] != undefined)) {
if (response.headers['Content-Type'].toLowerCase().indexOf('text/plain') != -1) {
type = 'txt';
} else if (response.headers['Content-Type'].toLowerCase().indexOf('json') != -1) {
type = 'json';
} else if (response.headers['Content-Type'].toLowerCase().indexOf('xml') != -1) {
type = 'xml';
} else if (response.headers['Content-Type'].toLowerCase().indexOf('csv') != -1) {
type = 'csv';
delim = ',';
} else if (response.headers['Content-Type'].toLowerCase().indexOf('tsv') != -1) {
type = 'tsv';
delim = "\t";
if (response.headers != undefined) {
var contentType = null;
if (response.headers['Content-Type'] != undefined) {
contentType = response.headers['Content-Type'];
} else if (response.headers['Content-type'] != undefined) {
contentType = response.headers['Content-type'];
} else if (response.headers['content-type'] != undefined) {
contentType = response.headers['content-type'];
}
if (null !== contentType) {
if (contentType.toLowerCase().indexOf('text/plain') != -1) {
type = 'txt';
} else if (contentType.toLowerCase().indexOf('json') != -1) {
type = 'json';
} else if (contentType.toLowerCase().indexOf('xml') != -1) {
type = 'xml';
} else if (contentType.toLowerCase().indexOf('csv') != -1) {
type = 'csv';
delim = ',';
} else if (contentType.toLowerCase().indexOf('tsv') != -1) {
type = 'tsv';
delim = "\t";
}
}
// Else, if string, try to detect from string
} else if (typeof response == 'string') {
Oops, something went wrong.

0 comments on commit 5724a17

Please sign in to comment.