@genee/fetch
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

@genee/fetch

Usage

import fetch from '@genee/fetch';

type UserData = {
    id: number;
    name: string;
};

(async () => {
    const user = await fetch<UserData>('path/to/user', {
        method: 'POST',
        body: {
            name: 'Doe John',
        },
        // timeout: 5000,   // default is 5000
        // json: true,      // default is true, return original text if json is false
        beforeRequest(url, init) {
        
        },
        customParser(r: Response, defaultParser: (r: Response) => any) {
            return defaultParser(r);
        },
    });
})();

Readme

Keywords

none

Package Sidebar

Install

npm i @genee/fetch

Weekly Downloads

3

Version

1.7.0

License

MIT

Unpacked Size

19.2 kB

Total Files

9

Last publish

Collaborators

  • iamfat