RESTful HTTP client library with composable interceptor architecture for Node.js and browsers
76
Build a reusable HTTP request logging system that tracks request and response metadata for API calls.
Your task is to create a logging utility that:
The logger should integrate with the HTTP request/response lifecycle and collect data at both the request phase (before sending) and response phase (after receiving).
@generates
/**
* Creates a request logger that captures request and response metadata.
*
* @param {Object} config - Configuration options
* @param {Array} [config.logs] - Optional array to store log entries for testing
* @returns {Function} A function that can wrap HTTP requests
*/
function createRequestLogger(config) {
// IMPLEMENTATION HERE
}
module.exports = {
createRequestLogger
};RESTful HTTP client library with composable interceptor architecture for Node.js and browsers
Install with Tessl CLI
npx tessl i tessl/npm-restevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10