fetch-ext
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

fetch() extension

Extension of native fetch with:

  • Retryable requests
  • Request timeout
  • Standalone HTTP utilities

options.extension

  • timeout number | string

    Request timeout

  • retry Object

    • limit number

      Default: 1

    • methods string[] | false

      Default: [DELETE, GET, HEAD, PATCH, PUT]

    • delay number | string | resolver

      Default: 100

  • json any

    Shortcut for sending JSON serialized data. Equivalent to:

    {
        headers: {
            'content-type': 'application/json',
            'accept':  'application/json',
        },
        body: JSON.stringify(value),
    }
    

response.extension

  • body()

    Infer and execute body parser based on content-type

Readme

Keywords

none

Package Sidebar

Install

npm i fetch-ext

Weekly Downloads

110

Version

1.1.0

License

none

Unpacked Size

46.1 kB

Total Files

25

Last publish

Collaborators

  • pete_b