json method

Future json()

Get Request as Json

If this request is not a json - Null will be returned

Implementation

Future<dynamic?> json() async {
  if (this.method != 'GET' &&
      this.headers.contentType?.mimeType != 'application/json') {
    return null;
  }

  return jsonDecode(
    await utf8.decoder.bind(this).join(),
  );
}