              set_script_prefix(prefix + self.orig_prefix)
  
      def final(self, request, response, *args, **kargs):
          """
          Hook for any code that needs to run after everything else in the view.
          """
          # Restore script_prefix.
          set_script_prefix(self.orig_prefix)
  
          # Always add these headers.
 
</s> remove 
        # Always add these headers.
        response.headers['Allow'] = ', '.join(self.allowed_methods)
        # sample to allow caching using Vary http header
        response.headers['Vary'] = 'Authenticate, Accept'

        # merge with headers possibly set at some point in the view
        response.headers.update(self.headers)
        return self.render(response)

    def add_header(self, field, value):
        """
        Add *field* and *value* to the :attr:`headers` attribute of the :class:`View` class.
        """
        self.headers[field] = value
 </s> add         return response </s> remove         Hook for any code that needs to run prior to anything else.
 </s> add         Returns an `HttpRequest`. This method is a hook for any code that needs to run
        prior to anything else. </s> remove         raise ErrorResponse(status.HTTP_405_METHOD_NOT_ALLOWED,
                            {'detail': 'Method \'%s\' not allowed on this resource.' % request.method})
 </s> add         raise ErrorResponse(content=
                {'detail': 'Method \'%s\' not allowed on this resource.' % request.method},
            status=status.HTTP_405_METHOD_NOT_ALLOWED) </s> remove     # TODO: wrap this behavior around dispatch(), ensuring it works
    # out of the box with existing Django classes that use render_to_response.
    def render(self, response):
        """
        Takes a :obj:`Response` object and returns an :obj:`HttpResponse`.
        """
 </s> add     response_class = Response

    def prepare_response(self, response):
        """
        Prepares response for the response cycle. Sets some headers, sets renderers, ...
        """
        if hasattr(response, 'request') and response.request is None:
            response.request = self.request
        # Always add these headers.
        response['Allow'] = ', '.join(allowed_methods(self))
        # sample to allow caching using Vary http header
        response['Vary'] = 'Authenticate, Accept'
        # merge with headers possibly set at some point in the view
        for name, value in self.headers.items():
            response[name] = value
        # set the views renderers on the response
        response.renderers = self.renderers
        # TODO: must disappear
        response.view = self
        Returns an `HttpResponse`. This method is a hook for any code that needs to run
        after everything else in the view.
              set_script_prefix(prefix + self.orig_prefix)
  
      def final(self, request, response, *args, **kargs):
          """
        Returns an `HttpResponse`. This method is a hook for any code that needs to run
        after everything else in the view.
          """
          # Restore script_prefix.
          set_script_prefix(self.orig_prefix)
  
          # Always add these headers.
keep keep keep keep replace keep keep keep keep keep
 Response as a subclass of HttpResponse - first draft, not quite there yet. 
djangorestframework/views.py