wraps a handler with an HTTP request-response cycle

async def _wrap_http(self, handler, *args, **kwargs):
        ''' wraps a handler with an HTTP request-response cycle'''
        try:
            method = self.request_method()
            # support preflight requests when CORS is enabled
            if method == 'OPTIONS':
                return self.build_http_response(None, status=NO_CONTENT)
            data = await handler(self, *args, **kwargs)
            # format the response object
            formatted = self.format(method, data)
            status = self.responses.get(method, OK)
            return self.build_http_response(formatted, status=status)
        except Exception as ex:
            return self.dispatch_error(ex)