How to use the @aws-sdk/middleware-stack.MiddlewareStack function in @aws-sdk/middleware-stack

To help you get started, we’ve selected a few @aws-sdk/middleware-stack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-sdk-js-v3 / packages / middleware-bucket-endpoint / src / bucketEndpointMiddleware.spec.ts View on Github external
it("should be inserted before 'hostheaderMiddleware' if exists", async () => {
    const stack = new MiddlewareStack();
    const mockHostheaderMiddleware = (next: any) => (args: any) => {
      args.request.arr.push("two");
      return next(args);
    };
    const mockbucketEndpointMiddleware = (next: any) => (args: any) => {
      args.request.arr.push("one");
      return next(args);
    };
    stack.add(mockHostheaderMiddleware, {
      ...bucketEndpointMiddlewareOptions,
      name: bucketEndpointMiddlewareOptions.toMiddleware
    });
    stack.addRelativeTo(
      mockbucketEndpointMiddleware,
      bucketEndpointMiddlewareOptions
    );

@aws-sdk/middleware-stack

Provides a means for composing multiple middleware functions into a single handler

Apache-2.0
Latest version published 1 year ago

Package Health Score

72 / 100
Full package analysis

Popular @aws-sdk/middleware-stack functions