Skip to content

Fetch extension. Retryable requests, timeouts and utilities.

Notifications You must be signed in to change notification settings

peteboere/fetch-ext

Repository files navigation

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

About

Fetch extension. Retryable requests, timeouts and utilities.

Resources

Stars

Watchers

Forks

Packages

No packages published