requestJSON method

Future requestJSON(
  1. HttpMethod method,
  2. String path, {
  3. Map<String, String>? headers,
  4. Credential? authorization,
  5. Map<String, Object?>? queryParameters,
  6. Object? body,
  7. String? contentType,
  8. String? accept,
})

Requests using method and path and returns a decoded JSON.

Implementation

Future<dynamic> requestJSON(HttpMethod method, String path,
    {Map<String, String>? headers,
    Credential? authorization,
    Map<String, Object?>? queryParameters,
    Object? body,
    String? contentType,
    String? accept}) async {
  return request(method, path,
          headers: headers,
          authorization: authorization,
          parameters: queryParameters,
          body: body,
          contentType: contentType,
          accept: accept)
      .then((r) => _jsonDecode(r.bodyAsString));
}