Return Template Response Assertion Results in API Explorer Error
search cancel

Return Template Response Assertion Results in API Explorer Error

book

Article ID: 42591

calendar_today

Updated On:

Products

CA API Developer Portal CA API Gateway

Issue/Introduction

If a policy author uses the "Return Template Response to Requestor" assertion with the "Send Response Immediately" checkbox ticked within their Gateway Published API or Policy Template, it will unset all of the CORS headers that are used to support testing via the API Explorer. The behavior that you would see in the API Explorer is that consumption fails due to the following error:

Error: Unable to make request. This may be due to a network error or a Cross-Origin Resource Sharing request pre-flight failure.

 

Environment

API Developer Portal SaaS (API Management Portal)

Resolution

Solution 1: Untick the "Send Response Immediately" checkbox within "Return Template Response to Requestor" assertion.

Solution 2: Use the built-in context variable called "response" to manipulate the response, as this will retain any headers already set within it.