Capturing an HTTP Response


I have a flow set up that begins with HTTP in node that receives requests from a .NET client. The parameters on the GET request are processed through a function node and then passed into an HTTP request node with authentication which calls into an external HTTP endpoint. The flows works fine and passes the response all the way back to the .NET client. My issue is that I would like to change this flow so that it is not simply a pass through. I would like to capture the response in the flow and then create my own response to pass back to the client. I am not sure how to intercept the response.

Thanks for any advice!

Here is an empty shell that represents the general architecture that I am speaking about:



You flows isn't importable
but I'm assuming you have something like

Can't you do what you want with
[HTTP-IN]-[function]-[httprequest]-[function where you do whatever modifications]-[http-out]



Sorry about the import problem! The structure you have outlined is what I have. Will that work, putting the logic in between the request and the out? I'll try it. Using a visual programming tool, it is a bit confusing, because it looks like everything is flowing in one direction. I want to capture and alter the response - not the msg on the request to the final node.



What response are you trying to alter?
I assumed you wanted to alter the data you get back from your http-request node before it is send back to your browser. So that your browser receives a modified response.



I want to retrieve the Response from the external (final) endpoint, extract a single property from the response and pass that back as the response to my client. So instead of the client getting the full response, it will only receive one property. I tried using a function where you suggested, setting msg.payload.Response to something else just to test. Unfortunately, the client (in this case I am testing with Postman, but could be a browser of course) is still receiving the full unaltered response.




Actually - I didn't have my function in the correct location. I switched to have the function directly between the request and response, it's working now! Thank you!