def __call__(self, environ, start_response):
<EOL>with util.StartResponseProxy() as start_response_proxy:<EOL><INDENT>body_iter = self.service_app(environ, start_response_proxy.Proxy)<EOL>status = start_response_proxy.response_status<EOL>headers = start_response_proxy.response_headers<EOL>exception = start_response_proxy.response_exc_info<EOL>body = start_response_proxy.response_body<EOL>if not body:<EOL><INDENT>body = '<STR_LIT>'.join(body_iter)<EOL><DEDENT><DEDENT>headers_dict = dict([(k.lower(), v) for k, v in headers])<EOL>if self.__is_json_error(status, headers_dict):<EOL><INDENT>status, body = self.protorpc_to_endpoints_error(status, body)<EOL>if '<STR_LIT>' in headers_dict:<EOL><INDENT>for index, (header_name, _) in enumerate(headers):<EOL><INDENT>if header_name.lower() == '<STR_LIT>':<EOL><INDENT>headers[index] = (header_name, str(len(body)))<EOL>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT>start_response(status, headers, exception)<EOL>return [body]<EOL>
Wrapper for the Endpoints server app.

        Args:
          environ: WSGI request environment.
          start_response: WSGI start response function.

        Returns:
          Response from service_app or appropriately transformed error response.