     var invokedSend = false
 
     //
-    // Current pre-flush lifecycle handler
+    // Lifecycle hook called on end()
     //
-    private var preFlush: PreFlushLifecycleHandler = {request, response in }
+    private var onEndInvoked: LifecycleHandler = {}
 
     ///
     /// Set of cookies to return with the response


///
/// Type alias for "Before flush" (i.e. before headers and body are written) lifecycle handler
public typealias PreFlushLifecycleHandler = (request: RouterRequest, response: RouterResponse) -> Void

    /// Sets the pre-flush lifecycle handler and returns the previous one
    ///
    /// - Parameter newPreFlush: The new pre-flush lifecycle handler
    public func setOnEndInvoked(_ newOnEndInvoked: LifecycleHandler) -> LifecycleHandler {
        let oldOnEndInvoked = onEndInvoked
        onEndInvoked = newOnEndInvoked
        return oldOnEndInvoked
    }


