json method

MethodWithBody json(
  1. dynamic body, {
  2. bool setHeaders = true,
})

Implementation

MethodWithBody json(body, {bool setHeaders: true}) {
  _body = codec.json.encode(body);
  if (setHeaders) {
    mimeType('application/json');
    header('Accept', 'application/json');
  }
  return this;
}