wonderful-fetch
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -23,3 +23,3 @@ (function (root, factory) { | ||
var SOURCE = 'library'; | ||
var VERSION = '1.1.1'; | ||
var VERSION = '1.1.2'; | ||
@@ -40,2 +40,3 @@ function WonderfulFetch(url, options) { | ||
options.output = typeof options.output === 'undefined' ? 'body' : options.output; | ||
options.attachResponseHeaders = typeof options.attachResponseHeaders === 'undefined' ? false : options.attachResponseHeaders; | ||
@@ -128,3 +129,6 @@ // Legacy | ||
// Add bm-properties to error object | ||
if (key === 'bm-properties' && isError) { | ||
if ( | ||
(key === 'bm-properties' || options.attachResponseHeaders) | ||
&& isError | ||
) { | ||
try { | ||
@@ -234,3 +238,4 @@ Object.keys(headers[key]).forEach(function (k) { | ||
var error = new Error(text || res.statusText || 'Unknown error'); | ||
Object.assign(error, { status: res.status }) | ||
Object.assign(error, { status: res.status }); | ||
console.log('--headers', res.headers); | ||
throw error; | ||
@@ -237,0 +242,0 @@ }) |
{ | ||
"name": "wonderful-fetch", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A wrapper around fetch.", | ||
@@ -34,4 +34,4 @@ "main": "./dist/index.js", | ||
"mocha": "^8.4.0", | ||
"prepare-package": "^1.0.0" | ||
"prepare-package": "^1.0.3" | ||
} | ||
} | ||
} |
16889
232