[Answer]-Should the response argument to `process_response` always be a subclass of HttpResponse?

1👍

Well, if it looks like a duck, and quacks like a duck…

But yes, your process_response() method should receive a HttpResponse subclass, not an exception. If your middleware receives an exception, it is most likely caused by returning a Http404, instead of raising it, in the view or a previous middleware method.

👤knbk

Leave a comment