'return-response' Policy Statement
How to use the "return-response" Policy statement to build the response from scratch for an Azure API service operation?
The "return-response" Policy Statement allows you to stop the Azure API processing immediately and return with the given response.
The "forward-request" statement can be used in three ways:
1. Return an empty response with status of 200:
2. Return a new response constructed with "set-status", "set-headers" and "set-body" child policy statements:
<return-response> <set-status... /> <set-header ... /> <set-body .../> </return-response>
For example, the following "inbound" policy returns a new response with status of 401:
<inbound> <return-response> <set-status code="401" reason="Unauthorized"/> <set-header name="WWW-Authenticate" exists-action="override"> <value>Bearer error="invalid_token"</value> </set-header> </return-response> <inbound>
3. Return an existing response created previously:
<return-response response-variable-name="existing context variable"> </return-response>
For example, the following "inbound" policy returns an existing response stored in a context variable:
<inbound> <return-response response-variable-name="context.Variables["loginResponse"]"> </return-response> <inbound>
2018-01-13, 204👍, 0💬
How To Generate and Process a Form with the Same Script in PHP? In previous exercises, a Web form is...
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...
How To Submit Values without Using a Form in PHP? If you know the values you want to submit, you can...
How To Create an Array with a Sequence of Integers or Characters in PHP? The quickest way to create ...
How To Quote Date and Time Values in SQL Statements in PHP? If you want to provide date and time val...