Skip to content

Ability to represent any body format for `Response()`

Choose a tag to compare

@neurosnap neurosnap released this 15 Feb 15:40
· 15 commits to main since this release
0476579

This release makes it possible to represent the body of Response() in any supported format by the Fetch API.

const fetchUsers = api.get('/users', function*(ctx, next) {
  ctx.bodyType = 'text'; // calls `Response.text()` instead of default `Response.json()`
  yield next();
});