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
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:
Convince service owners to always accept application/json;charset=UTF-8 as valid
Update core-client-rest to emit application/json without the charset
Handle this in the convenience layer
a custom pipeline policy
This issue tracks the final resolution and code changes. A workaround for KeyVault involves a custom policy
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