onHttpSuccess method

HttpActionResult onHttpSuccess(
  1. HttpResponse response,
  2. NodeSpec action,
  3. ActionContext context
)

Method used to handle a successful Http call. Conveniently placed in this class to facilitate overrides.

Implementation

HttpActionResult onHttpSuccess(
    HttpResponse response, NodeSpec action, ActionContext context) {
  final data = (response.headers[HttpHeaders.contentTypeHeader] ?? "")
          .contains("application/json")
      ? json.decodeWithReviver(response.body)
      : response.body;

  return HttpActionResult(true, returnData: data);
}