requestJSON method

Future requestJSON(
  1. HttpClient httpClient,
  2. HttpMethod method,
  3. String path, {
  4. bool fullPath = false,
  5. Credential? authorization,
  6. Map<String, String?>? queryParameters,
  7. Object? body,
  8. String? contentType,
  9. String? accept,
  10. OnCachedResponse? onStaleResponse,
  11. Duration? staleResponseDelay,
})

Does a request and decodes response to JSON.

Implementation

Future<dynamic> requestJSON(
  HttpClient httpClient,
  HttpMethod method,
  String path, {
  bool fullPath = false,
  Credential? authorization,
  Map<String, String?>? queryParameters,
  Object? body,
  String? contentType,
  String? accept,
  OnCachedResponse? onStaleResponse,
  Duration? staleResponseDelay,
}) async {
  return request(
    httpClient,
    method,
    path,
    fullPath: fullPath,
    authorization: authorization,
    queryParameters: queryParameters,
    body: body,
    contentType: contentType,
    accept: accept,
    onStaleResponse: onStaleResponse,
    staleResponseDelay: staleResponseDelay,
  ).then((r) => r.json);
}