Comparing version 3.0.1 to 3.0.2
var XMLHttpRequest = require('xhrpolyfill') | ||
module.exports = function xhr2 (params, callback) { | ||
// returns/calls: callback(data, response, xhr) | ||
var url = typeof params === 'string' ? params : params.url | ||
// e.g. url = "http://jsonplaceholder.typicode.com/posts/1" | ||
var method = params.method || (params.data ? 'POST': 'GET') | ||
var body = params.data // data: formdata or {key:val} | ||
var body = params.data | ||
var H = params.headers ? params.headers : params.body ? { | ||
@@ -15,3 +13,3 @@ 'X-Requested-With' :'XMLHttpRequest', | ||
xhr.open(method, url) | ||
for (var field in H) xhr.setRequestHeader(field, H[field]) | ||
for (var key in H) xhr.setRequestHeader(key, H[key]) | ||
xhr.onload = xhr.onerror = function (response) { | ||
@@ -18,0 +16,0 @@ var Hjson = {}, h = xhr.getAllResponseHeaders() |
{ | ||
"name": "minixhr", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "super simpel and small cross-browser xhr", | ||
@@ -5,0 +5,0 @@ "main": "minixhr.js", |
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
3409
23