Status code in response body transform

Tyk will by default run the response transform regardless of the status code of the response. I would like to be able to transform the response depending on what status code is returned… Something like:

{{if eq ._tyk_context.response_code 204}}
<ResponseCode>0</ResponseCode>
{{else}}
<ResponseCode>1</ResponseCode>
{{end}}

Having the same issue. Being 4 years, I cannot believe tyk doesn’t support such basic feature a revert proxy should have.

@Jianming_Qu Thanks for the feedback.

We understand that our users care about improving the product and we appreciate your suggestion. However, there hasn’t been a push for this feature request since you could achieve what you really want with the help of a response plugin. It might be a bit technical depending on your use case but it does get the job done.

Another alternative is by simply appending the response code in the body of the response and using the body transform to the check, parse and strip any unnecessary details. Of course this use case is limited but it should work for the example above.

Let us know if you are happy with this.