github sindresorhus/got v2.7.0
2.7.0

latest releases: v14.2.1, v14.2.0, v14.1.0...
9 years ago

New json option for auto-parsing JSON response. abdd0f0

Before:

got('jsonendpoint.com', function (err, data) {
    if (err) { return cb(err); }

    var json;

    try {
        json = JSON.parse(data);
    } catch (e) {
        return cb(new Error('Reponse from jsonendpoint.com is broken: ' + e.message));
    }

    // working with json
});

After:

got('jsonendpoint.com', {json: true}, function (err, json) {
    if (err) { return cb(err); }

    // working with json
});

v2.6.0...v2.7.0

Don't miss a new got release

NewReleases is sending notifications on new releases.