flickr-sdk
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -12,5 +12,13 @@ # Changelog | ||
## [v3.5.0] - 2017-11-02 | ||
Yay open source! This release upgrades superagent to [v3.8.0](https://github.com/visionmedia/superagent/releases/tag/v3.8.0), which includes [a patch](https://github.com/visionmedia/superagent/pull/1291) to allow for more control over response errors. | ||
#### Removed | ||
- [#118] Removed custom JSON parsers in favor of throwing in superagent's `.ok()` callback ([@jeremyruppel]) | ||
## [v3.4.0] - 2017-10-04 | ||
**Huge** shout out to [@ebisbe] for letting us know that the REST client was [super broken in the browser][https://github.com/flickr/flickr-sdk/issues/111]. This release fixes that! | ||
**Huge** shout out to [@ebisbe] for letting us know that the REST client was [super broken in the browser](https://github.com/flickr/flickr-sdk/issues/111). This release fixes that! | ||
@@ -134,3 +142,3 @@ #### Fixed | ||
[v3.3.0]: https://github.com/flickr/flickr-sdk/compare/v3.2.0...v3.3.0 | ||
[v3.3.0]: https://github.com/flickr/flickr-sdk/compare/v3.3.0...v3.4.0 | ||
[v3.4.0]: https://github.com/flickr/flickr-sdk/compare/v3.3.0...v3.4.0 | ||
[Unreleased]: https://github.com/flickr/flickr-sdk/compare/v3.3.0...master | ||
@@ -159,2 +167,3 @@ | ||
[#116]: https://github.com/flickr/flickr-sdk/pull/116 | ||
[#118]: https://github.com/flickr/flickr-sdk/pull/118 | ||
@@ -161,0 +170,0 @@ <!-- other links --> |
{ | ||
"name": "flickr-sdk", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Almost certainly the best Flickr API client in the world for node and the browser", | ||
@@ -21,3 +21,2 @@ "keywords": [ | ||
"browser": { | ||
"./plugins/json.js": "./plugins/json-browser.js", | ||
"./plugins/oauth.js": "./plugins/oauth-browser.js", | ||
@@ -66,3 +65,2 @@ "./services/oauth.js": "./services/oauth-browser.js" | ||
"nock": "~8.0.0", | ||
"node-http-xhr": "^1.3.4", | ||
"nyc": "^10.3.2", | ||
@@ -76,3 +74,3 @@ "ora": "^1.3.0", | ||
"dependencies": { | ||
"superagent": "^3.5.3-beta.2", | ||
"superagent": "^3.8.0", | ||
"xml2js": "^0.4.17" | ||
@@ -79,0 +77,0 @@ }, |
@@ -6,4 +6,2 @@ /*! | ||
var parseJSON = require('superagent/lib/node/parsers/json'); | ||
/** | ||
@@ -13,24 +11,23 @@ * Custom response parser routine to handle Flickr API-style | ||
* error codes, but they all come back as HTTP 200 responses. | ||
* Here, we extend the normal JSON response parser and check | ||
* Here, we add in additional logic to accommodate this and check | ||
* for a Flickr API error. If we find one, craft a new error | ||
* out of that and yield it. | ||
* out of that and throw it. | ||
* @param {Response} res | ||
* @param {Function} fn | ||
* @returns {null} | ||
* @returns {Boolean} | ||
* @throws {Error} | ||
*/ | ||
function parseFlickr(res, fn) { | ||
parseJSON(res, function (err, body) { | ||
if (err) { | ||
return fn(err, body); | ||
} | ||
function parseFlickr(res) { | ||
var body = res.body; | ||
var err; | ||
if (body.stat === 'fail') { | ||
err = new Error(body.message); | ||
err.stat = body.stat; | ||
err.code = body.code; | ||
} | ||
if (body && body.stat === 'fail') { | ||
err = new Error(body.message); | ||
err.stat = body.stat; | ||
err.code = body.code; | ||
fn(err, body); | ||
}); | ||
throw err; | ||
} | ||
return res.status >= 200 && res.status < 300; | ||
} | ||
@@ -48,3 +45,4 @@ | ||
req.query({ nojsoncallback: 1 }); | ||
req.parse(parseFlickr); | ||
req.type('json'); | ||
req.ok(parseFlickr); | ||
}; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
686743
17
18275
19
Updatedsuperagent@^3.8.0