minixhr
super simple and small cross-browser XMLHttpRequest (XHR)
USAGE
var minixhr = require('minixhr')
function response (error, data, header) {
if (error) return console.error(error)
console.log(data)
console.log(header)
}
const string = JSON.stringify({ foo: 123, bar: "abc" })
const URL1 = 'https://jsonplaceholder.typicode.com/posts/1'
const URL2 = 'http://requestb.in/18b4srl1'
var request1 = URL1
var request2 = {
url : URL2,
method : 'POST',
data : string,
headers : {},
timeout : 1000,
}
minixhr(request1, response)
minixhr(request2)
if you need to support old browsers, use version 3.1.0
or below.
Those versions still include the xhr polyfill