Socket
Socket
Sign inDemoInstall

@aws-sdk/protocol-http

Package Overview
Dependencies
2
Maintainers
5
Versions
116
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/protocol-http


Version published
Weekly downloads
4.8M
decreased by-5.29%
Maintainers
5
Install size
202 kB
Created
Weekly downloads
 

Package description

What is @aws-sdk/protocol-http?

@aws-sdk/protocol-http is a package within the AWS SDK for JavaScript that provides HTTP request and response handling functionalities. It is designed to facilitate communication with AWS services by creating and managing HTTP requests and responses.

What are @aws-sdk/protocol-http's main functionalities?

Creating HTTP Requests

This feature allows you to create an HTTP request object with specified hostname, method, path, and headers. This is useful for setting up requests to AWS services or other endpoints.

const { HttpRequest } = require('@aws-sdk/protocol-http');

const request = new HttpRequest({
  hostname: 'example.com',
  method: 'GET',
  path: '/path',
  headers: {
    'Content-Type': 'application/json'
  }
});

console.log(request);

Handling HTTP Responses

This feature allows you to create an HTTP response object with specified status code, headers, and body. This is useful for handling responses from AWS services or other endpoints.

const { HttpResponse } = require('@aws-sdk/protocol-http');

const response = new HttpResponse({
  statusCode: 200,
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ message: 'Success' })
});

console.log(response);

Middleware Integration

This feature demonstrates how to integrate middleware into the request/response lifecycle. Middleware can be used to add custom logic, such as logging or modifying requests and responses.

const { HttpRequest, HttpResponse } = require('@aws-sdk/protocol-http');
const { middlewareStack } = require('@aws-sdk/middleware-stack');

const stack = middlewareStack();

stack.add(
  (next, context) => async (args) => {
    console.log('Request:', args.request);
    const result = await next(args);
    console.log('Response:', result.response);
    return result;
  },
  {
    step: 'initialize',
    name: 'loggingMiddleware',
    priority: 'high'
  }
);

const request = new HttpRequest({
  hostname: 'example.com',
  method: 'GET',
  path: '/path'
});

stack.resolve(
  (handler) => handler({ request }),
  { request }
).then((result) => console.log(result));

Other packages similar to @aws-sdk/protocol-http

Changelog

Source

3.222.0 (2022-12-01)

Features

  • client-codecatalyst: This release adds operations that support customers using the AWS Toolkits and Amazon CodeCatalyst, a unified software development service that helps developers develop, deploy, and maintain applications in the cloud. For more information, see the documentation. (cb94b0c)
  • client-comprehend: Comprehend now supports semi-structured documents (such as PDF files or image files) as inputs for custom analysis using the synchronous APIs (ClassifyDocument and DetectEntities). (5c0d056)
  • client-gamelift: GameLift introduces a new feature, GameLift Anywhere. GameLift Anywhere allows you to integrate your own compute resources with GameLift. You can also use GameLift Anywhere to iteratively test your game servers without uploading the build to GameLift for every iteration. (b38a48f)
  • client-pipes: AWS introduces new Amazon EventBridge Pipes which allow you to connect sources (SQS, Kinesis, DDB, Kafka, MQ) to Targets (14+ EventBridge Targets) without any code, with filtering, batching, input transformation, and an optional Enrichment stage (Lambda, StepFunctions, ApiGateway, ApiDestinations) (c2e00d5)
  • client-sfn: This release adds support for the AWS Step Functions Map state in Distributed mode. The changes include a new MapRun resource and several new and modified APIs. (31a78be)
  • clients: update client endpoints as of 2022-12-01 (75af76d)
  • types: add checksum interface (#4216) (89598b6)
  • utl-retry: add util-retry package and its types (#4224) (a2579b7)

Readme

Source

@aws-sdk/protocol-http

NPM version NPM downloads

FAQs

Last updated on 01 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc