响应

当您需要更多地控制路由处理程序的响应时,可以使用此类。

codeheadersdata 传递到构造函数,并从任何路由处理程序返回实例。

import { Response } from 'miragejs';

this.get('/users', () => {
  return new Response(400, { some: 'header' }, { errors: [ 'name cannot be blank'] });
});