function flush(res, body) {
    assert.ok(
        body === null ||
            body === undefined ||
            typeof body === 'string' ||
            Buffer.isBuffer(body),
        'body must be a string or a Buffer instance'
    );

    res._data = body;

    // Flush headers
    res.writeHead(res.statusCode);

    // Send body if it was provided
    if (res._data) {
        res.write(res._data);
    }

    // Finish request
    res.end();

    // If log level is set to trace, log the entire response object
    if (res.log.trace()) {
        res.log.trace({ res: res }, 'response sent');
    }

    // Return the response object back out to the caller of __send
    return res;
}
Flush takes our constructed response object and sends it to the client

@private
@function flush
@param {Response} res - response
@param {String|Buffer} body - response body
@returns {Response} response