Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.09k stars 1.21k forks source link

[core] [core-client-rest] Content-Type for JSON should be application/json #31843

Open maorleger opened 2 days ago

maorleger commented 2 days ago

looks like core-client-rest uses application/json;charset=UTF-8 but core-client / autorest based mappers default to "application/json"

core-client-rest: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-client-rest/src/sendRequest.ts#L100-L107 keyvault-secrets: azure-sdk-for-js/sdk/keyvault/keyvault-secrets/src/generated/models/parameters.ts at main · maorleger/azure-sdk-for-js

The problem is that while application/json;charset=UTF-8 is accepted by most services it is not correct per the spec... RFC 8259 - The JavaScript Object Notation (JSON) Data Interchange Format because (AFAIK) all json must be UTF-8. My hunch is that most services just ignore the charset parameter. But, some services will complain about an unsupported content type

So I have a few options:

This issue tracks the final resolution and code changes. A workaround for KeyVault involves a custom policy

github-actions[bot] commented 2 days ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jlichwa @RandalliLama @schaabs.