Future decodeJson()

in functions_framework/lib/src/json_request_utils.dart [70:87]


  Future<Object?> decodeJson() async {
    try {
      final value = await (encoding ?? utf8)
          .decoder
          .bind(read())
          .transform(json.decoder)
          .single;
      return value;
    } on FormatException catch (e, stackTrace) {
      // https://github.com/GoogleCloudPlatform/functions-framework#http-status-codes
      throw BadRequestException(
        400,
        'Could not parse the request body as JSON.',
        innerError: e,
        innerStack: stackTrace,
      );
    }
  }