Skip to content

v5.1.0

Choose a tag to compare

@aleclarson aleclarson released this 26 May 16:14
· 10 commits to main since this release

Adds a more ergonomic client call signature for http.rawBody() routes that do not have path or query input.

Raw-body routes with route input continue to pass the payload through options.body:

export const uploadAvatar = http.post('profiles/:id/avatar', {
  body: http.rawBody(),
})

await client.uploadAvatar({ id: '42' }, { body: file })

Raw-body routes without route input can now pass the body as the first argument:

export const upload = http.post('uploads', {
  body: http.rawBody(),
})

await client.upload(file, {
  headers: { 'content-type': file.type },
})

Also fixes the standalone RouteRequestHandlerMap default middleware type so handler contexts no longer collapse to any when no middleware parameter is supplied.