mergeShelfResponse function

Future mergeShelfResponse(
  1. Response shelfResponse,
  2. ResponseContext angelResponse
)

Applies the state of the shelfResponse into the angelResponse.

Merges all headers, sets the status code, and writes the body.

In addition, the response's context will be available in angelResponse.properties as shelf_context.

Implementation

Future mergeShelfResponse(
    shelf.Response shelfResponse, ResponseContext angelResponse) {
  angelResponse.headers.addAll(shelfResponse.headers);
  angelResponse.statusCode = shelfResponse.statusCode;
  angelResponse.properties['shelf_context'] = shelfResponse.context;
  angelResponse.properties['shelf_response'] = shelfResponse;
  return shelfResponse.read().pipe(angelResponse);
}