Skip to content

v2.5.0

Choose a tag to compare

@MattCCC MattCCC released this 05 Aug 19:56
· 645 commits to master since this release

What's Changed

Features:

  • Allow to pass null to Query Params and URL Path Params
  • Accept per-request "baseURL", and do not use it, if url is provided directly
  • Performance: Don't run URL Path Replacement if it isn't necessary
  • Added possibility to use generics for responses in api.request and fetchf()
  • Performance: Bail early from appending Query Params if there are none to add
  • Handle other content types than application/json
  • Return request config and headers in the responses

Docs:

  • Added 2 more examples with api.request() and fetchf() usage in the examples.ts

Fixes:

  • Timeout error message url was not visible

Breaking:

  • flattenResponse setting is false by default
    To bring previous behavior either set it to "true" explicitly or start using destructuring for responses, e.g. change:
    const data = fetchf(...) to const { data } = fetchf(...)

Why "flattenResponse" is being changed to false?
Thanks to destructuring we can fit in more into the responses returned, so there is an easy access to errors, statuses etc. It helps when operating on the data. We also align it more with both axios and native fetch(). We will be able to add another properties like isLoading or isError in the near feature.

Full Changelog: v2.4.1...v2.5.0