# h2io-fetch

> Fetch wrapper used inside H2io modules

Latest version **0.0.2** (published 2016-04-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install h2io-fetch
pnpm add h2io-fetch
yarn add h2io-fetch
bun add h2io-fetch
```

## 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.0.2 |
| Published | 2016-04-14 |
| First published | 2016-04-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | h2io |

## Links

- npm: https://www.npmjs.com/package/h2io-fetch
- npm.io page: https://npm.io/package/h2io-fetch

## Dependencies (2)

- [es6-promise](https://npm.io/package/es6-promise.md) ^3.1.2
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1

## Recent versions

- 0.0.2 (latest) — 2016-04-14
- 0.0.1 — 2016-04-14

## README

# H2io - Fetch

## Installation

```bash
npm install h2io-fetch
```

## Usage

### GET

```js
import { jsonFetch } from 'h2io-fetch';

jsonFetch('//example.com')
  .then((obj) => console.log('response obj', obj))
  .catch((e) => throw new Error(e));
```

### POST

If we pass `body` fetch method will be `post`

```js
import { jsonFetch } from 'h2io-fetch';

const body = {
  firstName: 'John',
  lastName: 'Doe',
};

jsonFetch('//example.com', { body })
  .then((obj) => console.log('response obj', obj))
  .catch((e) => console.error(e));
```

## Options (default)

```js
const opts = {
  method: 'get',
  mode: 'cors',
  credentials: 'include',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
}
```

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