[QUERY] Delay after setting the response/mock in ApiManagement
See original GitHub issueLibrary name and version
Microsoft.Azure.Management.ApiManagement
Query/Question
We use the Api Management to mock endpoints. We set mock endpoints during tests and depending on which test is running, we change the mock.
With help of PolicyContract
we set our mocked content:
<policies>
<inbound>
<base />
<return-response>
<set-status code="200" />
<set-header name="Content-Type" exists-action="override">
<value>text/xml</value>
</set-header>
<set-body template="liquid">
<mockedcontent>content</mockedcontent>
</set-body>
</return-response>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
In code we use the nuget package Microsoft.Azure.Management.ApiManagement
to set the PolicyContract
. When we call the IApiOperationPolicyOperations.CreateOrUpdateWithHttpMessagesAsync
the operation is successful and afterwards IApiOperationPolicyOperations.GetWithHttpMessagesAsync
returns new updated PolicyContract
. But here comes the problem. The mocked endpoint itself doesn’t return the set mocked content directly. There is a delay before the endpoint is being updated. Currently we have code to check if the endpoint is updated. But this is creating other problems in our architecture.
Is this behavior attended? Should the method IApiOperationPolicyOperations.CreateOrUpdateWithHttpMessagesAsync
not return successful first when the endpoint is returning the updated value?
Is there another way how to detect if the mock endpoint has really
updated?
Environment
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top GitHub Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Will close this issue, feel free to open new issues if you have problems with SDK, thanks.