App Config Spring - Json content type fix#48448
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes JSON Content-Type detection to correctly handle media type parameters (e.g., ; charset=utf-8), restoring expected behavior for chat completions.
Changes:
- Strip Content-Type parameters before evaluating JSON media types.
- Improve structured-suffix (
+json) matching to be case-insensitive and whitespace-tolerant. - Expand unit test coverage for parameters, casing, whitespace, and edge cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParser.java | Strips ; parameters and improves subtype parsing for JSON detection. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParserTest.java | Adds broad test coverage for Content-Type variants (parameters/whitespace/case/edge cases). |
| sdk/spring/spring-cloud-azure-appconfiguration-config/CHANGELOG.md | Documents the bug fix in the changelog. |
You can also share your feedback on Copilot code review. Take the survey.
...a/com/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParser.java
Outdated
Show resolved
Hide resolved
...m/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParserTest.java
Outdated
Show resolved
Hide resolved
...m/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParserTest.java
Show resolved
Hide resolved
sdk/spring/spring-cloud-azure-appconfiguration-config/CHANGELOG.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Fixes JSON Content-Type detection in spring-cloud-azure-appconfiguration-config so values containing parameters (e.g., application/json; charset=utf-8) and structured syntax suffixes are correctly recognized as JSON, preventing JSON settings from being skipped.
Changes:
- Strip
;parameters before evaluating the media type and improve subtype parsing to check the structured syntax suffix after the last+. - Expand unit test coverage for
isJsonContentType, including parameterized content types and additional edge cases. - Document the bug fix in the module CHANGELOG.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/main/java/com/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParser.java | Fixes JSON content-type detection by stripping parameters and checking +json suffix correctly. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParserTest.java | Adds additional isJsonContentType test coverage for parameters, casing, whitespace, and edge cases. |
| sdk/spring/spring-cloud-azure-appconfiguration-config/CHANGELOG.md | Notes the JSON content-type parameter handling bug fix in the Unreleased section. |
You can also share your feedback on Copilot code review. Take the survey.
...m/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParserTest.java
Outdated
Show resolved
Hide resolved
...a/com/azure/spring/cloud/appconfiguration/config/implementation/JsonConfigurationParser.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Description
Fixes a bug where ';' wasn't checked when checking for json content type. Results in our chat completion type not working.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines