Setting a cookie in a middleware and passing to the next middleware in the chain

I have a _middleware.js file with a few middleware functions in it.
One of the functions needs to set (or clear) a specific cookie in a specific use case. Since that’s the only thing it needs to do (and the only thing it knows), I want to call next() to have the next middleware run, as opposed to creating a response object and set the set-cookie header on it and return the response object.