RESTful HTTP client library with composable interceptor architecture for Node.js and browsers
76
Build a configurable HTTP request logging system that tracks request metadata and response information.
Create a Node.js module that implements request logging functionality for HTTP requests. The system should:
Log request details including:
Log response details including:
Support configuration options:
logRequests: boolean flag to enable/disable request logging (default: true)logResponses: boolean flag to enable/disable response logging (default: true)logger: custom logging function (default: console.log)Implement proper composition so that logging functionality can be:
@generates
/**
* Creates a logging wrapper for HTTP requests
* @param {Object} config - Configuration options
* @param {boolean} [config.logRequests=true] - Enable request logging
* @param {boolean} [config.logResponses=true] - Enable response logging
* @param {Function} [config.logger=console.log] - Custom logging function
* @returns {Function} A function that wraps an HTTP client with logging
*/
function createLogger(config) {
// IMPLEMENTATION HERE
}
module.exports = createLogger;Provides RESTful HTTP client support with composable interceptor architecture.
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