minima-fetch.js
v1.1.1
Published
Simple fetch lib
Downloads
5
Readme
minima-fetch.js
It simple lib for simplification work with fetch
Installing
- Download
node.js
- Install this with npm:
npm i minima-fetch.js --save
or pnpmpnpm add minima-fetch.js
- Import in your project with import ES6:
import { minima } from 'minima-fetch.js'
Getting Started
This library already contains the necessary polyfill for fetch
. As well as initial errors during network requests are processed. So to just start using the script, you just need to pass it the necessary url and settings!: let response = await minima(url, settings);
Settings
method (String) (Optional)
- set method requestheaders (Object) (Optional)
- set headers of requestbody (Object) (Optional)
- set body of requestjson, text (Boolean) (Optional)
- set transformation typereadStream (Boolean) (Optional)
- get ReadableStream.getReader()
Returns
Return valid object
- if you set transform response object - { response:
networkResponse
, data:your transform data
} - if you not set transform data -
Object (networkResponse)
Return error object
- fetch require error - { message: 'Request is failed' }
- incorrect response status - { 'Request is incorrect, server error', networkResponse.status, Object (errors)}
License
License of project located in LICENSE file