Closed ItzNotABug closed 4 months ago
Current middleware behaviour only allows to add a interceptor for incoming requests. This PR adds support to intercept the outgoing responses too.
incoming
outgoing
The middleware behaviour is compatible with the previous implementation.
Example - Remove cookies from request & response.
appExpress.middleware({ incoming: (req) => delete req.headers.cookie, outgoing: (_, interceptor) => delete interceptor.headers.cookie, });
The interceptor contains the processed body which could be a String or a Buffer, statusCode & the headers.
interceptor
body
String
Buffer
statusCode
headers
Current middleware behaviour only allows to add a interceptor for
incoming
requests. This PR adds support to intercept theoutgoing
responses too.The middleware behaviour is compatible with the previous implementation.
Example - Remove cookies from request & response.
The
interceptor
contains the processedbody
which could be aString
or aBuffer
,statusCode
& theheaders
.