New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

h2tp

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

h2tp

Simple HTTP request module with zero dependencies

latest
Source
npmnpm
Version
2.5.2
Version published
Maintainers
0
Created
Source
const H2TP = require("./h2tp");

// simple GET request
H2TP.httpreq('http://example.com').then((r) => console.log(r.body));

// POST request
H2TP.httpreq({
    url: 'http://example.com',
    method: 'POST',
    payload: { data: "dummy" }, // since it's JavaScript object, it will be submitted as [Content-Type:application/json]
}).then((r) => {
    const data = r.body.trim();
    console.log(data);
    process.exit();
}, (err) => {
    console.log("error: " + err);
    process.exit();
});

/*
All options:
{
    url: string;
    method: 'GET'|'HEAD'|'POST'|'PUT'|'DELETE'|'TRACE'|'OPTIONS'|'CONNECT'|'PATCH';
    compression?: boolean; // default: true
    headers?: any;
    payload?: any;
    timeout?: number;
    proxy?: string;
    proxyTunneling?: boolean; // default: true
    maxRedirs?: number;
    agent?: http.Agent | https.Agent;
    onData?: (chunk: Buffer | string) => void;
    onSocket?: (socket: net.Socket) => void;
    onRequest?: (req: http.ClientRequest) => void;
}
*/

Keywords

HTTP

FAQs

Package last updated on 04 Feb 2025

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