Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maorleger opened this issue Nov 19, 2024 · 2 comments
Open
Assignees
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library.

Comments

@maorleger
Copy link
Member

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:

  • 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

@maorleger maorleger changed the title [core-client-rest] Content-Type for JSON should be application/json [core] [core-client-rest] Content-Type for JSON should be application/json Nov 19, 2024
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. KeyVault needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Attention Workflow: This issue is responsible by Azure service team. labels Nov 19, 2024
Copy link

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

@maorleger maorleger added Azure.Core and removed KeyVault Service Attention Workflow: This issue is responsible by Azure service team. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Nov 19, 2024
@maorleger maorleger self-assigned this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library.
Projects
Status: Untriaged
Development

No branches or pull requests

2 participants