2.5.2 • Published 5 months ago
h2tp v2.5.2
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;
}
*/
2.5.2
5 months ago
2.5.1
10 months ago
2.5.0
2 years ago
2.4.7
4 years ago
2.4.6
4 years ago
2.4.5
4 years ago
2.4.3
4 years ago
2.4.4
4 years ago
2.4.2
5 years ago
2.4.1
5 years ago
2.4.0
5 years ago
2.3.0
5 years ago
2.2.0
5 years ago
2.1.0
7 years ago
2.0.2
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.1.0
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago