Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@smithy/protocol-http
Advanced tools
[![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
@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.
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);
Axios is a popular promise-based HTTP client for the browser and Node.js. It provides a simple API for making HTTP requests and handling responses. Compared to @smithy/protocol-http, Axios offers more high-level features like request cancellation, automatic JSON transformation, and interceptors.
Node-fetch is a lightweight module that brings `window.fetch` to Node.js. It is a minimalistic library for making HTTP requests. While @smithy/protocol-http is more focused on providing utilities for building SDKs, node-fetch is more about providing a simple and familiar API for making HTTP requests in Node.js.
Superagent is a small progressive client-side HTTP request library, and Node.js module with a lot of features. It provides a flexible API for making HTTP requests and handling responses. Compared to @smithy/protocol-http, Superagent offers more high-level abstractions and built-in functionalities like query string parsing, form submissions, and file uploads.
FAQs
[![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
We found that @smithy/protocol-http demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.