Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function *xhrmw(next) {
if (!this.url) return yield next;
var opts = {
url: this.url,
body: this.body,
method: this.method,
headers: this.headers
};
var thunk = xhr.bind(null, opts);
var response = yield thunk;
var res = response[0];
if (res instanceof Error) throw res;
Object.keys(res).forEach(function(key) {
this.res[key] = res[key];
}.bind(this));
yield next;
}