UNPKG

als-request

Version:

versatile HTTP client offering enhanced features for Node.js with functionality for speed limitation with events, CORS management, stream support, automatic data preparation, error and response handling, and more

9 lines (8 loc) 199 B
module.exports = function(obj) { Object.defineProperty(obj, 'json', { get() { try { return JSON.parse(this.data); } catch (error) { return error } } }); }