github sindresorhus/got v2.7.0
2.7.0

New json option for auto-parsing JSON response. abdd0f09606fa4c79b277d2b637a9aa47b9c9643

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
});

https://github.com/sindresorhus/got/compare/v2.6.0...v2.7.0

latest releases: v11.7.0, v11.6.2, v11.6.1...
6 years ago