[Core] az rest: default JSON Content-Type for PUT/POST/PATCH body requests#33455
Draft
Copilot wants to merge 2 commits into
Draft
[Core] az rest: default JSON Content-Type for PUT/POST/PATCH body requests#33455Copilot wants to merge 2 commits into
az rest: default JSON Content-Type for PUT/POST/PATCH body requests#33455Copilot wants to merge 2 commits into
Conversation
❌AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Copilot
AI
changed the title
[WIP] Fix unsupported media type error in az rest command
[Core] May 28, 2026
az rest: default JSON Content-Type for PUT/POST/PATCH body requests
Collaborator
|
Core |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related command
az rest --uri /subscriptions/$subId/resourceGroups/$rg/providers/Microsoft.Web/sites/$appname/config/authsettings?api-version=2020-09-01 --method put --body auth4.jsonDescription
az restcould send body payloads for PUT/POST/PATCH withoutContent-Type, which causes ARM/RP endpoints to return HTTP 415 (UnsupportedMediaType) when they require JSON.This change makes header behavior deterministic for body-carrying methods while preserving explicit user headers.
Behavior change
send_raw_request, whenbodyis provided and method isPUT/POST/PATCH, setContent-Type: application/jsonif not already specified.--headers Content-Type=....Regression coverage
auth4.json) to verify:Illustrative snippet
Testing Guide
az rest --method put --uri <arm-url> --body auth4.jsonContent-Type: application/json(unless overridden via--headers).History Notes
[Core]
az rest: DefaultContent-Type: application/jsonfor PUT/POST/PATCH requests with body when not explicitly provided.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.