

def send_wsgi_response(status, headers, content, start_response, cors_handler=None):
    'Dump reformatted response to CGI start_response.\n\n  This calls start_response and returns the response body.\n\n  Args:\n    status: A string containing the HTTP status code to send.\n    headers: A list of (header, value) tuples, the headers to send in the\n      response.\n    content: A string containing the body content to write.\n    start_response: A function with semantics defined in PEP-333.\n    cors_handler: A handler to process CORS request headers and update the\n      headers in the response.  Or this can be None, to bypass CORS checks.\n\n  Returns:\n    A string containing the response body.\n  '
    if cors_handler:
        cors_handler.update_headers(headers)
    content_len = (len(content) if content else 0)
    headers = [(header, value) for (header, value) in headers if (header.lower() != 'content-length')]
    headers.append(('Content-Length', ('%s' % content_len)))
    start_response(status, headers)
    return content

dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/endpoints/util.py send_wsgi_response/original