tessl install tessl/npm-rest@2.0.0RESTful HTTP client library with composable interceptor architecture for Node.js and browsers
Agent Success
Agent success rate when using this tile
76%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.29x
Baseline
Agent success rate without this tile
59%
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.