# ez-fetch

> A fetch wrapper to simplify network requests.

Latest version **1.2.0** (published 2018-03-13) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-03-13 |
| First published | 2018-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | w3cj |
| Maintainers | w3cj |

## Links

- npm: https://www.npmjs.com/package/ez-fetch
- Repository: https://github.com/w3cj/ez-fetch
- Homepage: https://github.com/w3cj/ez-fetch#readme
- Issues: https://github.com/w3cj/ez-fetch/issues
- npm.io page: https://npm.io/package/ez-fetch

## Dependencies (2)

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

## Recent versions

- 1.2.0 (latest) — 2018-03-13
- 1.1.2 — 2018-03-13
- 1.1.1 — 2018-03-13
- 1.1.0 — 2018-03-13
- 1.0.1 — 2018-02-22

## README

# ez-fetch

A fetch wrapper to simplify network requests.

* Includes `es6-promise`, `isomorphic-fetch` for use in older browsers and for use in a node.js environment
* Inspects `content-type` header to parse response correctly
* Throws an error (`catch`) if the response is not OK
* Stringifies JSON and sets `content-type` header

# Examples

```js
const ezFetch = require('ez-fetch');

// GET
ezFetch
  .get('https://example.com')
  .then(body => {
    console.log(body);
  }).catch(error => {
    console.error(error);
  });

// POST, PATCH, PUT, DELETE
// url, body, fetchOptions
ezFetch
  .post('https://example.com/create', {
    title: 'Hello World'
  }, {
    headers: {
      Authorization: 'Bearer 12345'
    }
  }).then(result => {
    console.log(result);
  }).catch(error => {
    console.error(error);
  });
```

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