Keeping original payload data while editing it

Ok...

You're referring to HTTP Request (that is a Node) - hence my confusion :crazy_face:
(but I didn't have a look at the flow to be fair - so that is on me)

Directly after the HTTP IN node

  • Use a change node to store msg.payload in msg.original (use deep clone)
  • After you make changes to payload (for the client)
    • Respond (to client)
  • Then to store the original incoming data, and response to a file (after you respond)
  • use something like below
const Log  = {
  request: msg.original,
  response: msg.payload
}

return {payload:JSON.stringify(Log)}

Send the above function to the file wrote node?

Insurance: I still may have this wrong