Permalink
Browse files

fixes for ie6 compatibility

  • Loading branch information...
1 parent d50a19c commit e50b0fb0bc85c1f4e02c489021be4bf14832953d @substack committed Nov 27, 2012
Showing with 11 additions and 3 deletions.
  1. +9 −1 lib/request.js
  2. +1 −1 lib/response.js
  3. +1 −1 package.json
View
@@ -100,7 +100,7 @@ Request.unsafeHeaders = [
Request.prototype.isSafeRequestHeader = function (headerName) {
if (!headerName) return false;
- return (Request.unsafeHeaders.indexOf(headerName.toLowerCase()) === -1)
+ return indexOf(Request.unsafeHeaders, headerName.toLowerCase()) === -1;
};
var objectKeys = Object.keys || function (obj) {
@@ -112,3 +112,11 @@ var objectKeys = Object.keys || function (obj) {
var isArray = Array.isArray || function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]';
};
+
+var indexOf = function (xs, x) {
+ if (xs.indexOf) return xs.indexOf(x);
+ for (var i = 0; i < xs.length; i++) {
+ if (xs[i] === x) return i;
+ }
+ return -1;
+};
View
@@ -44,7 +44,7 @@ function parseHeaders (res) {
}
Response.prototype.getResponse = function (xhr) {
- var respType = xhr.responseType.toLowerCase();
+ var respType = String(xhr.responseType).toLowerCase();
if (respType === 'blob') return xhr.responseBlob;
if (respType === 'arraybuffer') return xhr.response;
return xhr.responseText;
View
@@ -1,6 +1,6 @@
{
"name" : "http-browserify",
- "version" : "0.1.5",
+ "version" : "0.1.6",
"description" : "http module compatability for browserify",
"main" : "index.js",
"browserify" : "index.js",

0 comments on commit e50b0fb

Please sign in to comment.