-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Key Vault SDKs sometimes manipulate request bodies during challenge-based authentication. Specifically, when sending unauthenticated requests to prompt a challenge, the request body is removed. After the challenge is received, the body content is repopulated with the set_text_body method:
Line 121 in 9881093
| request.http_request.set_text_body(body) # no-op when text is None |
Today, this code works because KV uses non-DPG code generation; request objects are from azure.core.pipeline.transport instead of azure.core.rest. When DPG is used, requests start to fail because of a breaking change in HttpRequest.set_text_body's behavior: calling the method changes the request's Content-Type header from "application/json" to "text/plain", instead of leaving the header untouched (current behavior).
Recorded tests for azure-keyvault-keys succeed again after DPG generation if
request.http_request.headers["Content-Type"] = "application/json"is inserted after any calls to set_text_body.