Comparing version 1.0.3 to 1.1.0
@@ -95,3 +95,3 @@ /** Jan is a simple library for making HTTP requests. | ||
status : xhr.status, | ||
error : xhr.status>399 ? xhr.statusText : null, | ||
error : !xhr.status ? 'Connection Error' : xhr.status>399 ? xhr.statusText : null, | ||
headers : {}, | ||
@@ -98,0 +98,0 @@ body : xhr.responseText, |
@@ -1,2 +0,2 @@ | ||
/*! jan 1.0.2 */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof module&&module.exports?module.exports=b():a.jan=b()}(this,function(){function a(a,c,d){d&&(a=e(c||{},{url:a}),c=d),a="string"==typeof a?{url:a}:a||{},a.baseUrl&&(a.url=a.baseUrl+a.url),a.headers=a.headers||{};var f=new XMLHttpRequest,g={xhr:f,req:a};b("req",g),(f=g.xhr).open(a.method||"GET",a.url||"/",!0,a.user,a.pass);for(var i in a.headers)h.call(a.headers,i)&&f.setRequestHeader(i,a.headers[i]);f.onreadystatechange=function(){if(4===f.readyState){var d,e={status:f.status,error:f.status>399?f.statusText:null,headers:{},body:f.responseText,xml:f.responseXML,xhr:f},h=/^\s*([a-z0-9_-]+)\s*\:\s*(.*?)\s*$/gim,i=f.getAllResponseHeaders();try{e.json=JSON.parse(e.body)}catch(j){}for(e.data=e.json||e.xml||e.body;d=h.exec(i);)e.headers[d[1].toLowerCase()]=d[2];g.res=e,b("res",g),(c||a.callback).call(g,e.error,e,e.data)}},f.send(a.body)}function b(b,c){c=Array.prototype.slice.call(arguments,1);for(var d=f[b],e=d.length;e--;)d[e].apply(a,c)}function c(b){return function(c,d){return a(e({},"string"==typeof c?{url:c}:c,b),d)}}function d(a,b){for(var d=g.length;d--;)a[g[d].toLowerCase()]=c(e({},b||{},{method:g[d]}));return a.del=a["delete"],a}function e(a){for(var b,c,d=1;d<arguments.length;d++){c=arguments[d];for(b in c)h.call(c,b)&&(a[b]=c[b])}return a}var f={req:[],res:[]},g="GET POST PUT DELETE HEAD OPTIONS".split(" "),h={}.hasOwnProperty;return a.ns=function(b){var e={baseUrl:b},f=d(c(e),e);return f.on=function(c,d,e){return a.on(c,b+(d.sub?d:""),e||d),f},f},a.on=function(b,c,d){return f[b].push(d?function(a){(c.exec?a.req.url.match(c):0===a.req.url.indexOf(c))&&d.call(this,a)}:c),a},d(a),a.jan=a.request=a}); | ||
/*! jan 1.1.0 */ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof module&&module.exports?module.exports=b():a.jan=b()}(this,function(){function a(a,c,d){d&&(a=e(c||{},{url:a}),c=d),a="string"==typeof a?{url:a}:a||{},a.baseUrl&&(a.url=a.baseUrl+a.url),a.headers=a.headers||{};var f=new XMLHttpRequest,g={xhr:f,req:a};b("req",g),(f=g.xhr).open(a.method||"GET",a.url||"/",!0,a.user,a.pass);for(var i in a.headers)h.call(a.headers,i)&&f.setRequestHeader(i,a.headers[i]);f.onreadystatechange=function(){if(4===f.readyState){var d,e={status:f.status,error:f.status?f.status>399?f.statusText:null:"Connection Error",headers:{},body:f.responseText,xml:f.responseXML,xhr:f},h=/^\s*([a-z0-9_-]+)\s*\:\s*(.*?)\s*$/gim,i=f.getAllResponseHeaders();try{e.json=JSON.parse(e.body)}catch(j){}for(e.data=e.json||e.xml||e.body;d=h.exec(i);)e.headers[d[1].toLowerCase()]=d[2];g.res=e,b("res",g),(c||a.callback).call(g,e.error,e,e.data)}},f.send(a.body)}function b(b,c){c=Array.prototype.slice.call(arguments,1);for(var d=f[b],e=d.length;e--;)d[e].apply(a,c)}function c(b){return function(c,d){return a(e({},"string"==typeof c?{url:c}:c,b),d)}}function d(a,b){for(var d=g.length;d--;)a[g[d].toLowerCase()]=c(e({},b||{},{method:g[d]}));return a.del=a["delete"],a}function e(a){for(var b,c,d=1;d<arguments.length;d++){c=arguments[d];for(b in c)h.call(c,b)&&(a[b]=c[b])}return a}var f={req:[],res:[]},g="GET POST PUT DELETE HEAD OPTIONS".split(" "),h={}.hasOwnProperty;return a.ns=function(b){var e={baseUrl:b},f=d(c(e),e);return f.on=function(c,d,e){return a.on(c,b+(d.sub?d:""),e||d),f},f},a.on=function(b,c,d){return f[b].push(d?function(a){(c.exec?a.req.url.match(c):0===a.req.url.indexOf(c))&&d.call(this,a)}:c),a},d(a),a.jan=a.request=a}); |
{ | ||
"name": "jan", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Jan is a simple library for making HTTP requests.", | ||
@@ -5,0 +5,0 @@ "main": "dist/jan.js", |
@@ -95,3 +95,3 @@ /** Jan is a simple library for making HTTP requests. | ||
status : xhr.status, | ||
error : xhr.status>399 ? xhr.statusText : null, | ||
error : !xhr.status ? 'Connection Error' : xhr.status>399 ? xhr.statusText : null, | ||
headers : {}, | ||
@@ -98,0 +98,0 @@ body : xhr.responseText, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
599275