Skip to content

Commit a0ac158

Browse files
authored
Add ContentType.APPLICATION_ZIP_COMPRESSED (#524)
1 parent d171fcf commit a0ac158

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

RELEASE_NOTES.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
Release 5.4-alpha1
2+
------------------
3+
4+
This is the first release in the 5.4 release series.
5+
6+
7+
Change Log
8+
-------------------
9+
10+
* Add ContentType.APPLICATION_ZIP_COMPRESSED.
11+
Contributed by Gary Gregory <ggregory at apache.org>
12+
13+
114
Release 5.3
215
------------------
316

httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ public final class ContentType implements Serializable {
7575
public static final ContentType APPLICATION_JSON = create(
7676
"application/json", StandardCharsets.UTF_8);
7777

78+
/**
79+
* Public constant media type for ZIP archives {@code application/x-zip-compressed}.
80+
* <p>
81+
* Note that Windows uploads {@code .zip} files with this non-standard MIME type.
82+
* </p>
83+
*
84+
* @see <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types">ZIP archive application/x-zip-compressed</a>
85+
* @since 5.4
86+
*/
87+
public static final ContentType APPLICATION_ZIP_COMPRESSED = create("application/x-zip-compressed");
88+
7889
/**
7990
* Public constant media type for {@code application/x-ndjson}.
8091
* @since 5.1

httpcore5/src/test/java/org/apache/hc/core5/http/TestContentType.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
*/
4141
class TestContentType {
4242

43+
@Test
44+
void testApplicationZipCompressed() {
45+
final ContentType contentType = ContentType.create("application/x-zip-compressed");
46+
Assertions.assertEquals(contentType.toString(), ContentType.APPLICATION_ZIP_COMPRESSED.toString());
47+
Assertions.assertTrue(contentType.isSameMimeType(ContentType.APPLICATION_ZIP_COMPRESSED));
48+
Assertions.assertTrue(ContentType.APPLICATION_ZIP_COMPRESSED.isSameMimeType(contentType));
49+
}
50+
4351
@Test
4452
void testBasis() throws Exception {
4553
final ContentType contentType = ContentType.create("text/plain", "US-ASCII");

0 commit comments

Comments
 (0)