<div dir="ltr">Hello,<div><br></div><div>I&#39;m trying to make a handler that manages a request scoped sql transaction. Ideally it would be a middleware handler that opens the connection and starts the transaction and after the chain of handlers is finished it will commit the transaction. The issue I am facing is the browser can receive the data before the transaction is committed since the data is sent further down the chain.</div><div><br></div><div>Is there some type of hook where I can commit / close the transaction before any data is sent? This should work fine in a blocking handler but an asynchronous one may have issues?</div><div><br></div><div>My other thought is to make a Handler that expects some object to be returned. In this handler commit / close the connection as soon as the object is returned then send the data to the browser after. Would this be my best option?</div><div><br></div><div>Thanks,</div><div>Bill</div></div>