postInvocationResponse method

Future<HttpClientResponse> postInvocationResponse (
  1. InvocationResult result
)

Post the invocation response to the AWS Lambda Runtime Interface.

Implementation

Future<HttpClientResponse> postInvocationResponse(
    InvocationResult result) async {
  final request = await _client.postUrl(
    Uri.parse(
      'http://${runtimeApi}/${runtimeApiVersion}/runtime/invocation/${result.requestId}/response',
    ),
  );
  request.add(
    utf8.encode(
      json.encode(result.body),
    ),
  );

  return await request.close();
}