@fatcherjs/middleware-parameter
v3.0.0-alpha-10
Published
<a href="https://npmjs.com/package/@fatcherjs/middleware-parameter"><img src="https://img.shields.io/npm/v/@fatcherjs/middleware-parameter.svg" alt="npm package"></a> [![install size](https://packagephobia.com/badge?p=@fatcherjs/middleware-parameter)](htt
Downloads
502
Readme
@fatcherjs/middleware-parameter
Install
NPM
>$ npm install @fatcherjs/middleware-parameter
CDN
<script src="https://cdn.jsdelivr.net/npm/@fatcherjs/middleware-parameter/dist/index.min.js"></script>
Usage
import { fatcher } from 'fatcher';
import { parameter } from '@fatcherjs/middleware-parameter';
fatcher('https://foo.bar', {
params: {
foo: 'bar',
},
middlewares: [parameter({})],
}); // url is https://foo.bar?foo=bar
Options
serializer
import qs from 'qs;
import { fatcher } from 'fatcher';
import { parameter, Serializer } from '@fatcherjs/middleware-parameter';
const serializer: Serializer = (params) => qs.stringify(params);
fatcher('https://foo.bar', {
params: {
foo: 'bar',
},
middlewares: [parameter({
serializer
})],
});