[Test-Proxy] Enforce `content-type` consistently across Various API Controllers
- Dominant language
- C#
- Stars
- 135
- Forks
- 260
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 143
Description
Right now, when one `POSTS` to `Record/Stop` the test-proxy accepts a JSON body that is essentially a simple dictionary.
```json
{
"variable": "value"
}
```
We do this as part of [Variables](https://github.com/Azure/azure-sdk-tools/tree/main/tools/test-proxy/Azure.Sdk.Tools.TestProxy#storing-variables) support.
There's a problem though. When POSTING to `Record/Stop/` with a body to configure a sanitizer, `Content-Type: Application/Json` is **required**. That in and of itself is not the problem.
The real problem is that, when originally implementing the `Admin` controller, I was quite a newbie and did _not_ mandate the presence of `content-type: application/json` header when POSTING to
- `/Admin/AddSanitizer`
- `/Admin/AddTransform`
- `/Admin/SetMatcher`
Even though we explicitly look at the json-converted http body to retrieve the _settings_ of the sanitizer (targeting is in headers).
For consistency's sake, we absolutely should do the right thing and require the content-type wherever a JSON body is posted.
Mandating the presence of this content-type is technically a breaking change, but I'm going to pull the bandaid off this week rather than later.
Contributor guide
Assessment
This issue has not been assessed yet.