Skip to content

Commit

Permalink
add docs reflecting
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Sep 8, 2023
1 parent 250e970 commit c2613da
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tools/test-proxy/Azure.Sdk.Tools.TestProxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ Add a more expansive Header sanitizer that uses a target group instead of filter

```jsonc
// POST to URI <proxyURL>/Admin/AddSanitizer
// dictionary dictionary
// headers
{
"x-abstraction-identifier": "HeaderRegexSanitizer"
}
Expand All @@ -549,6 +549,36 @@ Each sanitizer is optionally prefaced with the **specific part** of the request/

A sanitizer that does _not_ include this prefix is something different, and probably applies at the session level instead on an individual request/response pair.

#### Passing sanitizers in bulk

In some cases, users need to register a lot (10+) of sanitizers. In this case, going back and forth with the proxy server individually is not very efficient. To ameliorate this, the proxy honors multiple sanitizers in the same request if the user utilizes `/Admin/AddSanitizers`.

```jsonc
// POST to URI <proxyURL>/Admin/AddSanitizers
// note the request body is simply an array of objects
[
{
"Name": "GeneralRegexSanitizer",
"Body": {
"regex": "[a-zA-Z]?",
"value": "hello_there",
"condition": {
"UriRegex": ".+/Tables"
}
}
},
{
"Name": "HeaderRegexSanitizer",
"Body": { // <-- the contents of this property mirror what would be passed in the request body for individual AddSanitizer()
"key": "Location",
"value": "fakeaccount",
"regex": "https\\:\\/\\/(?<account>[a-z]+)\\.(?:table|blob|queue)\\.core\\.windows\\.net",
"groupForReplace": "account"
}
}
]
```

### For Sanitizers, Matchers, or Transforms in general

When invoked as basic requests to the `Admin` controller, these settings will be applied to **all** further requests and responses. Both `Playback` and `Recording`. Where applicable.
Expand Down

0 comments on commit c2613da

Please sign in to comment.