# popsicle-transport-http

> Popsicle transport for sending requests over HTTP1 and HTTP2

Latest version **1.2.1** (published 2021-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install popsicle-transport-http
pnpm add popsicle-transport-http
yarn add popsicle-transport-http
bun add popsicle-transport-http
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2021-11-15 |
| First published | 2019-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 172.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Blake Embrey |
| Maintainers | blakeembrey |
| Keywords | popsicle, transport, http, http2, response |

## Links

- npm: https://www.npmjs.com/package/popsicle-transport-http
- Repository: https://github.com/serviejs/popsicle-transport-http
- Issues: https://github.com/serviejs/popsicle-transport-http/issues
- npm.io page: https://npm.io/package/popsicle-transport-http

## Dependencies (1)

- [make-error-cause](https://npm.io/package/make-error-cause.md) ^2.2.0

## Recent versions

- 1.2.1 (latest) — 2021-11-15
- 1.2.0 — 2021-11-12
- 1.1.4 — 2021-04-29
- 1.1.3 — 2021-03-16
- 1.1.2 — 2021-02-14
- 1.1.1 — 2021-01-11
- 1.1.0 — 2021-01-11
- 1.0.9 — 2020-09-29
- 1.0.8 — 2020-06-11
- 1.0.7 — 2020-02-02
- 1.0.6 — 2019-11-03
- 1.0.5 — 2019-11-03
- 1.0.4 — 2019-06-15
- 1.0.3 — 2019-06-15
- 1.0.2 — 2019-06-15
- … 2 more at https://npm.io/package/popsicle-transport-http/versions

## README

# Popsicle Transport HTTP

[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][build-image]][build-url]
[![Build coverage][coverage-image]][coverage-url]

> Popsicle transport for sending requests over HTTP1 and HTTP2.

## Installation

```
npm install popsicle-transport-http --save
```

## Usage

```js
import { transport } from "popsicle-transport-http";

const req = new Request("/");
const res = await transport()(req, done);
```

### Transport Options

The `transport` function sends the Servie `Request` to a remote server.

- `keepAlive?: number` Duration to keep connection alive for re-use (default: `5000`)
- `servername?: string` Override remote server name for TLS
- `rejectUnauthorized?: boolean` Rejects unauthorized TLS connections
- `negotiateHttpVersion?: NegotiateHttpVersion` Configure HTTP version negotiation (default: `HTTP2_FOR_HTTPS`)
- `lookup?: DnsLookup` Override default DNS resolution (default: `dns.lookup`)
- TLS options:
  - `ca?: string | Buffer | Array<string | Buffer>` Set TLS CA
  - `cert?: string | Buffer` Set TLS certificate
  - `key?: string | Buffer` Set TLS key
  - `secureContext?: SecureContext` Set TLS secure context
  - `secureProtocol?: string` Set TLS secure protocol
  - `secureOptions?: number` Set TLS secure options
- Custom connection managers (default: `Infinity` active sockets):
  - `tlsSockets?: ConnectionManager<TLSSocket>`
  - `netSockets?: ConnectionManager<Socket>`
  - `http2Sessions?: ConnectionManager<ClientHttp2Session>`
- Custom create connections (all methods support async promises):
  - `createHttp2Connection?: (authority, socket) => ClientHttp2Session`
  - `createNetConnection?: (options) => Socket`
  - `createTlsConnection?: (options) => TLSSocket`

## TypeScript

This project is written using [TypeScript](https://github.com/Microsoft/TypeScript) and publishes the definitions directly to NPM.

## License

MIT

[npm-image]: https://img.shields.io/npm/v/popsicle-transport-http.svg?style=flat
[npm-url]: https://npmjs.org/package/popsicle-transport-http
[downloads-image]: https://img.shields.io/npm/dm/popsicle-transport-http.svg?style=flat
[downloads-url]: https://npmjs.org/package/popsicle-transport-http
[build-image]: https://img.shields.io/github/workflow/status/serviejs/popsicle-transport-http/CI/main
[build-url]: https://github.com/serviejs/popsicle-transport-http/actions/workflows/ci.yml?query=branch%3Amain
[coverage-image]: https://img.shields.io/codecov/c/gh/serviejs/popsicle-transport-http
[coverage-url]: https://codecov.io/gh/serviejs/popsicle-transport-http

---
_Source: https://npm.io/package/popsicle-transport-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
