Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11322 closed (fixed)

Description of process_response Middleware method incorrect

Reported by: mmalone Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: middleware documentation response
Cc: mjmalone@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The Middleware documentation says that if some middleware returns an HttpResponse object from its process_response() method, other middleware that follows it in the chain will not be executed. While this is true for the process_request() and process_view() methods, it is not true for process_response() (see relevant code for how request, view, and response middleware is handled). In fact, the process_response() method must return an HttpResponse object, as its return value is used as the response object passed to any other middleware, and eventually rendered as an HTTP response.

I also think it's worth noting in the description of process_response() that, if present, this method will always be called for every response, even if request middleware that precedes it in the middleware stack short circuits and returns an HttpResponse.

Since both of these appear to be intentional design decisions I've attached a small documentation patch that addresses both issues.

Attachments (1)

middleware_docs.diff (1.6 KB) - added by mmalone 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by mmalone

comment:1 Changed 7 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [11048]) Fixed #11322 -- Clarified docs regarding middleware processing. Thanks the Michael Malone for the patch.

comment:3 Changed 7 years ago by russellm

(In [11060]) [1.0.X] Fixed #11322 -- Clarified docs regarding middleware processing. Thanks the Michael Malone for the patch.

Merge of r11048 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top