wonderful-fetch
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -23,3 +23,3 @@ (function (root, factory) { | ||
var SOURCE = 'library'; | ||
var VERSION = '0.0.10'; | ||
var VERSION = '0.0.11'; | ||
@@ -36,11 +36,11 @@ function WonderfulFetch(url, options) { | ||
options.contentType = (typeof options.contentType === 'undefined' ? '' : options.contentType).toLowerCase(); | ||
options.responseFormat = (typeof options.responseFormat === 'undefined' ? 'raw' : options.responseFormat).toLowerCase(); | ||
options.response = (typeof options.response === 'undefined' ? 'raw' : options.response).toLowerCase(); | ||
// Legacy | ||
if (options.raw) { | ||
options.responseFormat = 'raw' | ||
options.response = 'raw' | ||
} else if (options.json) { | ||
options.responseFormat = 'json' | ||
options.response = 'json' | ||
} else if (options.text) { | ||
options.responseFormat = 'text' | ||
options.response = 'text' | ||
} | ||
@@ -143,3 +143,3 @@ | ||
if (options.ok && options.download) { | ||
if (res.ok && options.download) { | ||
jetpack = jetpack || require('fs-jetpack'); | ||
@@ -165,3 +165,3 @@ if (!jetpack.exists(options.download)) { | ||
if (res.ok) { | ||
if (options.responseFormat === 'raw') { | ||
if (options.response === 'raw') { | ||
return _resolve(res); | ||
@@ -171,3 +171,3 @@ } else { | ||
.then(function (text) { | ||
if (options.responseFormat === 'json') { | ||
if (options.response === 'json') { | ||
JSON5 = JSON5 || require('json5'); | ||
@@ -174,0 +174,0 @@ try { |
{ | ||
"name": "wonderful-fetch", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "A wrapper around fetch.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -83,3 +83,3 @@ <p align="center"> | ||
* Default: `get` | ||
* responseFormat `string`: Format of the response | ||
* response `string`: Automatically format the response | ||
* Acceptable Values: `raw`, `json`, `text` | ||
@@ -86,0 +86,0 @@ * Default: `raw` |
14946