# boomerang-http

> Simplified wrapper around the fetch API

Latest version **0.1.0** (published 2021-02-26) · Open BSV License license · 0 weekly downloads

## Install

```sh
npm install boomerang-http
pnpm add boomerang-http
yarn add boomerang-http
bun add boomerang-http
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2021-02-26 |
| First published | 2021-02-26 |
| Weekly downloads | 0 |
| License | Open BSV License |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Peer-to-Peer Privacy Systems Research LLC |
| Maintainers | tyeverett |

## Links

- npm: https://www.npmjs.com/package/boomerang-http
- Repository: https://github.com/p2ppsr/boomerang
- Homepage: https://github.com/p2ppsr/boomerang#readme
- Issues: https://github.com/p2ppsr/boomerang/issues
- npm.io page: https://npm.io/package/boomerang-http

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0

## Recent versions

- 0.1.0 (latest) — 2021-02-26

## README

# boomerang-http

Simplified wrapper around the fetch API

## Name and Meaning

You throw the boomerang through cyberspace at a URL. It comes back and hits you in the face, ideally with the data you want.

## Usage

```js
import boomerang from 'boomerang-http'

const data = await boomerang(
  'POST',
  'https://example.com',
  {
    para: 'meter'
  },
  {
    hea: 'der'
  }
)
```

## API

The package exports a single function, `boomerang`, which requests your data.

### `boomerang(HTTPMethod, URL, requestPayload, headers) => response`

This function will parse your data into the correct format for the HTTP method used, send the request and parse the response into either a JSON object or a string.

#### Parameters

Name       | Optional | Description
-----------|----------|---------------
`method`   | No       | The HTTP method to use for the request
`URL`      | No       | The URL to request
`params`   | Yes      | Request parameters. For GET, these will be your query string parameters. For POST, this will be sent as the JSON request body
`headers`  | Yes      | Any additional headers to include with the request

#### Return Value

The function will return a Promise for either a JavaScript object (if the response was JSON), or a string value.

#### Throws

This function will throw native errors if they occur. No custom errors are defined. This is a wrapper for the [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). Please consult the documentation for more information.

## License

The license for the code in this repository is the Open BSV License.

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