'Does the request dispatching.  Matches the URL and returns the
return value of the view or error handler.  This does not have to
be a response object.  In order to convert the return value to a
proper response object, call :func:`make_response`.
.. versionchanged:: 0.7
This no longer does the exception handling, this code was
moved to the new :meth:`full_dispatch_request`.'

def dispatch_request(self):

    req = _request_ctx_stack.top.request
    if (req.routing_exception is not None):
        self.raise_routing_exception(req)
    rule = req.url_rule
    if (getattr(rule, 'provide_automatic_options', False) and (req.method == 'OPTIONS')):
        return self.make_default_options_response()
    return self.view_functions[rule.endpoint](**req.view_args)
