Mostly 200 OK returns if the Rest call is successful. We handle the code to be returned and along with a custom message to override the default behavior. For which we can use pub.flow:setResponseCode. And the body comprises any details related to call like employee details fetched or ID fetched etc. mostly in case of GET method.
For your case, you aren’t looking for returning any body in response. But Integration Server by default uses the content-type from Accept header field coming in the request to form the response. and it supersedes with Content-Type as text/html. So any system handling your response if they do HTML decode the response they will find nothing i.e. empty response. Without decode, it will show those tags. This is the default behavior of content-handlers in the Integration Server for HTTP responses. you can refer to the Integration Server Administrator Guide for the same.
I still tried and got a result as you need, if you are willing to try then you can do this.
Using pub.flow:setResponse ( deprecated one ), you just do below for variables
- Just initialize responseString var, do not pass space or something.
- And for contentType var, you canexplicitly type in as - text/plain
This way you are getting 200 OK without any HTML tags, as the content-Type we used is text/plain.
Unfortunately pub.flow:setResonse2 mandates valid value in responseString or responseBytes either one of this.
These are my findings. I would still recommend either send a body or get it decoded at the client end, rather than using the deprecated method.