The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Whats the point of middleware "response" argument

realart's Avatar

realart

06 Sep, 2015 09:06 PM

Why does middleware have to have both request and response as arguments?

Why can't it just accept request and next middleware callable as arguments and return response as return value?

This is so confusing!

  1. Support Staff 1 Posted by Andrew Smith on 10 Sep, 2015 08:25 AM

    Andrew Smith's Avatar

    Because you can do response before and/or after next, this is the reason for having a response object.

    What is so confusing about this?

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac