CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-aws-sdk--client-sts

AWS SDK for JavaScript STS Client for Node.js, Browser and React Native, providing temporary security credentials and role assumption capabilities

92

1.05x

Evaluation92%

1.05x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-4/

Request Logger with Custom HTTP Handler

A utility that wraps AWS SDK clients with a custom HTTP handler to intercept and log all outgoing HTTP requests for debugging and monitoring purposes.

Capabilities

Intercepts HTTP requests

  • When a request is made, the onRequest callback is invoked with the request details (URL, method, headers) @test
  • When multiple requests are made sequentially, the onRequest callback is invoked for each one @test

Integrates with AWS SDK clients

  • The custom handler can be configured on an STS client using the requestHandler option @test
  • When calling STS operations (e.g., GetCallerIdentity), the custom handler intercepts the request @test

Forwards requests to actual handler

  • After logging, the custom handler calls the delegate handler's handle method with the request @test
  • The HTTP response from the delegate handler is returned to the caller without modification @test

Implementation

@generates

API

/**
 * Represents a logged HTTP request
 */
export interface LoggedRequest {
  url: string;
  method: string;
  headers: Record<string, string>;
  body?: string;
}

/**
 * Creates a custom HTTP handler that logs requests and delegates to another handler
 *
 * @param delegateHandler - The actual HTTP handler to forward requests to (e.g., NodeHttpHandler)
 * @param onRequest - Callback invoked for each request with logged request details
 * @returns A custom request handler that can be used with AWS SDK clients
 */
export function createLoggingHandler(
  delegateHandler: any,
  onRequest: (request: LoggedRequest) => void
): any;

Dependencies { .dependencies }

@aws-sdk/client-sts { .dependency }

Provides AWS STS client for testing request interception

@satisfied-by

@aws-sdk/types { .dependency }

Provides type definitions for HTTP handlers

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-aws-sdk--client-sts

tile.json