Socket
Socket
Sign inDemoInstall

@smithy/protocol-http

Package Overview
Dependencies
2
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @smithy/protocol-http

[![NPM version](https://img.shields.io/npm/v/@smithy/protocol-http/latest.svg)](https://www.npmjs.com/package/@smithy/protocol-http) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/protocol-http.svg)](https://www.npmjs.com/package/@smithy/protocol


Version published
Weekly downloads
21M
increased by4.99%
Maintainers
0
Created
Weekly downloads
 

Package description

What is @smithy/protocol-http?

@smithy/protocol-http is a package that provides HTTP utilities for the Smithy framework, which is used to build SDKs for AWS services. It includes classes and functions to create and manipulate HTTP requests and responses, making it easier to interact with HTTP-based APIs.

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

Creating HTTP Requests

This feature allows you to create an HTTP request object with specified method, hostname, and path.

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

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

console.log(request);

Handling HTTP Responses

This feature allows you to create an HTTP response object with specified status code, headers, and body.

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

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

console.log(response);

Parsing HTTP Headers

This feature allows you to parse raw HTTP headers into a structured object.

const { parseHeaders } = require('@smithy/protocol-http');

const rawHeaders = 'Content-Type: application/json\nContent-Length: 123';
const headers = parseHeaders(rawHeaders);

console.log(headers);

Other packages similar to @smithy/protocol-http

Readme

Source

@smithy/protocol-http

NPM version NPM downloads

FAQs

Last updated on 27 Jun 2024

Did you know?

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