Skip to content

Commit

Permalink
Made TEXT_PLAIN no implicit
Browse files Browse the repository at this point in the history
  • Loading branch information
arturobernalg committed Sep 24, 2024
1 parent 4b6f836 commit d39f85d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public final class ContentType implements Serializable {
"text/markdown", StandardCharsets.UTF_8, false);

public static final ContentType TEXT_PLAIN = create(
"text/plain", StandardCharsets.UTF_8, true);
"text/plain", StandardCharsets.UTF_8, false);
public static final ContentType TEXT_XML = create(
"text/xml", StandardCharsets.UTF_8, false);
/**
Expand Down Expand Up @@ -432,9 +432,7 @@ public static ContentType create(final String mimeType, final Charset charset) {
* @param mimeType MIME type. It may not be {@code null} or empty. It may not contain
* characters {@code <">, <;>, <,>} reserved by the HTTP specification.
* @return content type
* @deprecated Use {@link #create(String, Charset, boolean)} with an explicit charset or null, and specify if the charset is implicit.
*/
@Deprecated
public static ContentType create(final String mimeType) {
return create(mimeType, (Charset) null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void testDefaultContent() throws Exception {
httpentity = new StringEntity(s, StandardCharsets.US_ASCII);
Assertions.assertEquals("text/plain; charset=US-ASCII", httpentity.getContentType());
httpentity = new StringEntity(s);
Assertions.assertEquals("text/plain", httpentity.getContentType());
Assertions.assertEquals("text/plain; charset=UTF-8", httpentity.getContentType());
}

private static String constructString(final int [] unicodeChars) {
Expand Down

0 comments on commit d39f85d

Please sign in to comment.