Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

A library to keep-alive and write requests directly onto a Net/TLS socket for HTTP and HTTPS requests.

License

Notifications You must be signed in to change notification settings

lewisgibson/https-keepalive-proxy-tunnel

Repository files navigation

https-keepalive-proxy-tunnel

A library to keep-alive and write requests directly onto a Net/TLS socket for HTTP and HTTPS requests.

NPM Package Build Status Coverage Status TypeCov Codechecks

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 6.0 or higher is required.

Installation is done using the npm install command:

# NPM Users
$ npm install --save @robinlemon/https-keepalive-proxy-tunnel

# Yarn Users
$ yarn add @robinlemon/https-keepalive-proxy-tunnel

Usage

Quickstart

import { Agent } from '@robinlemon/https-keepalive-proxy-tunnel';

/**
 * Simple
 */
const { Body, Response, StatusCode } = await Agent.Request('https://www.google.com/', 'http://username?:password?@domain-or-ip:port?/');

/**
 * Custom Types
 */
interface IApiResponse {
    response: {
        id: number;
        name: string;
    }[];
}
const { Body, Response, StatusCode } = await Agent.Request<IApiResponse>(
    'https://www.google.com/some/random/api/path/post',
    'http://username?:password?@domain-or-ip:port?/',
    {
        Method: 'POST',
        Headers: {
            'X-CSRF-TOKEN': 'MySecurityToken',
        },
    },
);

See __tests__ for more examples.

Tests

To run the test suite, first install the dependencies, then run npm test:

# NPM Users
$ npm install
$ npm test

# Yarn Users
$ yarn
$ yarn test

License

MIT

About

A library to keep-alive and write requests directly onto a Net/TLS socket for HTTP and HTTPS requests.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published