tools/test-proxy/Azure.Sdk.Tools.TestProxy/Views/Info/MetadataDump.cshtml (213 lines of code) (raw):

@using Azure.Sdk.Tools.TestProxy.Models; @model AvailableMetadataModel @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Test-Proxy - Available Extensions</title> @await Html.PartialAsync("css.cshtml") </head> <body> <h1> Test-Proxy - Available Extensions </h1> <p> The test-proxy supports "extensions" or "customizations" to the recording experience. What this really means is that non-default <code>sanitization</code>, <code>matching</code>, and response <code>transformation</code> are all possible. </p> <p> This page serves as an index of all these available customizations. They range from generalized regex find/replace to on-the-fly updating of a played back response with updated <code>Date</code> and <code>request-id</code> headers. </p> <p> To leverage any of the below extensions, your local test framework should POST to the <code>Admin</code> controller. Below is an example. </p> <pre> METHOD: POST URL: PROXYURL/Admin/AddSanitizer HEADERS: { "x-abstraction-identifier": "GeneralRegexSanitizer" } BODY: { "value": "fakeaccount", "regex": "https\:\/\/(?&lt;account&gt;[a-z]+)\.(?:table|blob|queue)\.core\.windows\.net", "groupForReplace": "account" } </pre> <p> You should provide a single header value. One that identifies the the <b>exact</b> name of an existing session customization. The key/value pairs visible in the body correspond to mandatory arguments defined by each customization. These are higlighted in the information available below! </p> <p> Also note that the above example is adding a <code>sanitizer</code>, which is one of three session customizations offered by this test proxy. <ul> <li>/Admin/AddSanitizer</li> <li>/Admin/AddTransform</li> <li>/Admin/SetMatcher</li> </ul> </p> <p> To observe which customizations are currently active on your session, visit <a href="/Info/Active">/Info/Active/</a>. </p> <h1>Available Sanitizers</h1> <p> A <b>sanitizer</b> is applied to recordings in two locations <ul> <li> Before they are saved. (Affects the session as a whole as well as individual entries) </li> <li> During playback, when a request comes in from a client. This means that only individual entry sanitizers apply in this case. </li> </ul> This is due to the fact that during playback, there is no session context. The test-proxy can only operate against the request that just came in. Sanitizers are optionally prefixed with a title that indicates where each sanitizer applies. These prefixes are: <ul> <li> <code>Uri</code> </li> <li> <code>Header</code> </li> <li> <code>Body</code> </li> </ul> For example, A sanitizer prefixed with <code>Body</code> will only ever operate on the request/response body. The target URI and request/response headers will be left unaffected. </p> @foreach (var extension in Model.Sanitizers) { <table style="width:100%"> <tr> <td> <h2>@extension.Name</h2> </td> </tr> <tr> <td> <h3>Description</h3> <p> @extension.Description </p> </td> </tr> <tr> <td> <h3>Constructor</h3> @if (!String.IsNullOrEmpty(extension.ConstructorDetails.Description) || extension.ConstructorDetails.Arguments.Count() > 0) { <p> @Html.Raw(@extension.ConstructorDetails.Description) </p> <ul> @foreach (var arg in extension.ConstructorDetails.Arguments) { <li><span><code>@arg.Item1</code></span>: @arg.Item2</li> } </ul> } else { <p class="unused"> This sanitizer either does have a constructor description or does not offer customization beyond applying it to your session. </p> } </td> </tr> </table> } <h1>Available Matchers</h1> <p> A <b>matcher</b> is applied during a playback session. The default matcher matches a request on <b>headers</b>, <b>URI</b>, and <b>the body.</b> </p> <p> This is the least used customization as most adjustments to matching really come down to sanitizing properly before storing the recording. Further, when using this customization, it is recommended that one passes the <code>x-recording-id</code> header so that the adjusting matching only occurs for a specific recording during playback. </p> @foreach (var extension in Model.Matchers) { <table style="width:100%"> <tr> <td> <h2>@extension.Name</h2> </td> </tr> <tr> <td> <h3>Description</h3> <p> @extension.Description </p> </td> </tr> <tr> <td> <h3>Constructor</h3> @if (!String.IsNullOrEmpty(extension.ConstructorDetails.Description) || extension.ConstructorDetails.Arguments.Count() > 0) { <p> @Html.Raw(@extension.ConstructorDetails.Description) </p> <ul> @foreach (var arg in extension.ConstructorDetails.Arguments) { <li><span><code>@arg.Item1</code></span>: @arg.Item2</li> } </ul> } else { <p class="unused"> This matcher either does have a constructor description or does not offer customization beyond applying it to your session. </p> } </td> </tr> </table> } <h1>Available Transforms</h1> <p>A <b>transform</b> extends functionality of the test-proxy by applying to responses just before they are returned during <b>playback</b> mode.</p> @foreach (var extension in Model.Transforms) { <table style="width:100%"> <tr> <td> <h2>@extension.Name</h2> </td> </tr> <tr> <td> <h3>Description</h3> <p> @extension.Description </p> </td> </tr> <tr> <td> <h3>Constructor</h3> @if (!String.IsNullOrEmpty(extension.ConstructorDetails.Description) || extension.ConstructorDetails.Arguments.Count() > 0) { <p> @Html.Raw(@extension.ConstructorDetails.Description) </p> <ul> @foreach (var arg in extension.ConstructorDetails.Arguments) { <li><span><code>@arg.Item1</code></span>: @arg.Item2</li> } </ul> } else { <p class="unused"> This transform either does have a constructor description or does not offer customization beyond applying it to your session. </p> } </td> </tr> </table> } </body> </html>