knucklebone.js
function newRequest(reqOptions) {
		/*
  	reqOptions.url
  	reqOptions.method
  	reqOptions.contentType
  	reqOptions.data
  */
		var XHR_REQ = addHandlers(new XMLHttpRequest());

		XHR_REQ.addEventListener('readystatechange', function (evt) {
			if (XHR_REQ.readyState === 4) handleResponse(XHR_REQ, reqOptions);
		});

		XHR_REQ.open(reqOptions.method, reqOptions.url);

		if (reqOptions.headers) {
			(0, _lodash8.default)(reqOptions.headers, function (val, key) {
				if (key === 'withCredentials' && val === true) XHR_REQ.withCredentials = 'true';else XHR_REQ.setRequestHeader(key, val);
			});
		}

		if (reqOptions.method === 'GET') XHR_REQ.send();else {
			if (reqOptions.requestContentType === 'json') {
				XHR_REQ.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
				if ((0, _lodash4.default)(reqOptions.data)) XHR_REQ.send(JSON.stringify(reqOptions.data));else XHR_REQ.send(reqOptions.data);
			} else if (reqOptions.requestContentType === 'urlencoded') {
				XHR_REQ.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				XHR_REQ.send(reqOptions.data);
			} else XHR_REQ.send(reqOptions.data);
		}
		return XHR_REQ;
	}
function newRequest(reqOptions) {
		/*
  	reqOptions.url
  	reqOptions.method
  	reqOptions.contentType
  	reqOptions.data
  */
		var XHR_REQ = addHandlers(new XMLHttpRequest());

		XHR_REQ.addEventListener('readystatechange', function (evt) {
			if (XHR_REQ.readyState === 4) handleResponse(XHR_REQ, reqOptions);
		});

		XHR_REQ.open(reqOptions.method, reqOptions.url);

		if (reqOptions.headers) {
			(0, _lodash8.default)(reqOptions.headers, function (val, key) {
				if (key === 'withCredentials' && val === true) XHR_REQ.withCredentials = 'true';else XHR_REQ.setRequestHeader(key, val);
			});
		}

		if (reqOptions.method === 'GET') XHR_REQ.send();else {
			if (reqOptions.requestContentType === 'json') {
				XHR_REQ.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
				if ((0, _lodash4.default)(reqOptions.data)) XHR_REQ.send(JSON.stringify(reqOptions.data));else XHR_REQ.send(reqOptions.data);
			} else if (reqOptions.requestContentType === 'urlencoded') {
				XHR_REQ.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				XHR_REQ.send(reqOptions.data);
			} else XHR_REQ.send(reqOptions.data);
		}
		return XHR_REQ;
	}
function newRequest ( reqOptions ) { /*
  	reqOptions.url
  	reqOptions.method
  	reqOptions.contentType
  	reqOptions.data
  */ var XHR_REQ = addHandlers ( new XMLHttpRequest ( ) ) ; XHR_REQ . addEventListener ( 'readystatechange' , function ( evt ) { if ( XHR_REQ . readyState === 4 ) handleResponse ( XHR_REQ , reqOptions ) ; } ) ; XHR_REQ . open ( reqOptions . method , reqOptions . url ) ; if ( reqOptions . headers ) { ( 0 , _lodash8 . default ) ( reqOptions . headers , function ( val , key ) { if ( key === 'withCredentials' && val === true ) XHR_REQ . withCredentials = 'true' ; else XHR_REQ . setRequestHeader ( key , val ) ; } ) ; } if ( reqOptions . method === 'GET' ) XHR_REQ . send ( ) ; else { if ( reqOptions . requestContentType === 'json' ) { XHR_REQ . setRequestHeader ( 'Content-Type' , 'application/json;charset=UTF-8' ) ; if ( ( 0 , _lodash4 . default ) ( reqOptions . data ) ) XHR_REQ . send ( JSON . stringify ( reqOptions . data ) ) ; else XHR_REQ . send ( reqOptions . data ) ; } else if ( reqOptions . requestContentType === 'urlencoded' ) { XHR_REQ . setRequestHeader ( 'Content-Type' , 'application/x-www-form-urlencoded' ) ; XHR_REQ . send ( reqOptions . data ) ; } else XHR_REQ . send ( reqOptions . data ) ; } return XHR_REQ ; }
/* Create new request
/ * Create new request