There is no such thing as res.body
. The body of the HTTP response can be created by many different methods, for example res.send
or res.write
in combination with res.end
. For this reason, there is no standard way to "inject" some text into the body. In particular, it is impossible to add anything after sending of the body has been completed with res.end
.
If you could specify how the exisiting middleware creates the response body, we could judge whether it is possible to modify this behavior through addition of another middleware. But the additional middleware will depend heavily on the existing middleware, and it might be easier to achieve your goal by modifying the existing middleware.