1.3.0 - 2025.02-16
-
The
serializeBody
option now receives any non nullish body as its first argument. Previously it received jsonifiable values only.The valid
body
type can now be restricted by typing theserializeBody
option's first argument.let upfetch = up(fetch, () => ({ // accept FormData only serializeBody: (body: FormData) => body, })) // ❌ type error: the body is not a FormData upfetch('https://example.com', { method: 'POST', body: { name: 'John' }, }) // ✅ works fine with FormData upfetch('https://example.com', { method: 'POST', body: new FormData(), })
-
upfetch's 2nd argument no longer has a functional signature. Instead,
up
receives the fetcher arguments to tailor the defaults based on the request.Example:
let upfetch = up(fetch, (input, options) => ({ baseUrl: 'https://example.com', timeout: typeof input === 'string' && input.startsWith('/export/') ? 30000 : 5000, }))
- new
isJsonifiable
utility to determine if a value can be safely converted tojson
1.2.4 - 2025.02-11
- add a
ValidationError
along with anisValidationError
type guard
1.2.3 - 2025.02-02
timeout
option, making it easier to set a timeout alogn with a signal.
1.2.0 - 2025.01-31
- renamed option
onBeforeFetch
toonRequest
- renamed type
ComputedOptions
toResolvedOptions
1.1.1 - 2025.01-30
- Removed peerDependencies in package.json
1.1.0 - 2025.01-29
- renamed
parseResponseErrorWhen
toparseResponseError
1.0.0 - 2025.01-28
- Added the
schema
option following the Standard Schema Specification - Added the
onError
hook onup
- removed all
upfetch
hooks (on***) - remove all
up
error hooks (on***Error) in favor ofonError
- removed the
transform
option
0.7.0 - 2024-05-06
- Added
transform
option
- remove the
withTranform
adapter
- Better
options
type inferrence in the interceptors