Remove charset from application/json mimetype#10109
Merged
Conversation
db663e3 to
2e26525
Compare
evandongen
reviewed
Dec 8, 2025
| fullContentType = fullContentType.withCharset(getCharSet()); | ||
| if(StringUtils.isNotEmpty(getContentType()) && headerParamsSet.stream().noneMatch(e -> e.equalsIgnoreCase("content-type"))) { | ||
| defaultContentType = ContentType.parse(getContentType()); | ||
| if(defaultContentType.getCharset() == null && !"application/json".equals(defaultContentType.getMimeType())) { |
Contributor
There was a problem hiding this comment.
Kan je hier wellicht naar org.apache.http.entity.ContentType#APPLICATION_JSON kijken?
Contributor
There was a problem hiding this comment.
ipv de application/json string
Member
Author
There was a problem hiding this comment.
Maar het is toch niet handig een object met een string te vergelijken?
nielsm5
commented
Dec 8, 2025
| } | ||
| MimeType mimeType = message != null ? message.getContext().getMimeType() : null; | ||
|
|
||
| MimeType mimeType = message != null ? MessageUtils.computeMimeType(message) : null; |
Member
Author
There was a problem hiding this comment.
This is now always a compute step.
nielsm5
commented
Dec 8, 2025
| t.transform(xmlSource, outputTarget); | ||
|
|
||
| setEntity(new ByteArrayEntity(outputStream.toByteArray())); | ||
| setEntity(new ByteArrayEntity(outputStream.toByteArray(), CONTENT_TYPE)); |
Member
Author
There was a problem hiding this comment.
Since the ContentType is always known, no need to compute.
nielsm5
commented
Dec 8, 2025
|
|
||
| case DELETE: | ||
| HttpDelete deleteMethod = new HttpDelete(relativePath.toString()); | ||
| if (null != getFullContentType()) { // Manually set Content-Type header |
Member
Author
There was a problem hiding this comment.
GET, DELETE and REPORT don't use Content-Types 😄
nielsm5
commented
Dec 8, 2025
| // check if computedType is one of the supported types, or else use the defaultMediaType | ||
| return Arrays.stream(SupportedMediaType.values()) | ||
| .filter(supportedType -> supportedType.mediaType.equals(computedType)) | ||
| .filter(supportedType -> supportedType.mediaType.equalsTypeAndSubtype(computedType)) |
|
tnleeuw
approved these changes
Dec 8, 2025
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.



No description provided.