def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
<EOL>self.args = args<EOL>self.kwargs = kwargs<EOL>request = self.initialize_request(request, *args, **kwargs)<EOL>self.request = request<EOL>self.headers = self.default_response_headers  <EOL>try:<EOL><INDENT>self.initial(request, *args, **kwargs)<EOL>if request.method.lower() in self.http_method_names:<EOL><INDENT>handler = getattr(self, request.method.lower(),<EOL>self.http_method_not_allowed)<EOL><DEDENT>else:<EOL><INDENT>handler = self.http_method_not_allowed<EOL><DEDENT>if handler != self.http_method_not_allowed:<EOL><INDENT>self.initialize_context(request, *args, **kwargs)<EOL><DEDENT>response = handler(request, *args, **kwargs)<EOL><DEDENT>except Exception as exc:<EOL><INDENT>response = self.handle_exception(exc)<EOL><DEDENT>self.response = self.finalize_response(request, response, *args, **kwargs)<EOL>return self.response<EOL>
`.dispatch()` is pretty much the same as DRF's regular dispatch,
but with extra logic to initialize a local context.
Please check parent methods for more info.