Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

Commit 14507d0

Browse files
committed
Fix some unit test after upgrade to latest Jetty
1 parent c03bf4d commit 14507d0

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

jooby-core/src/main/java/jooby/MediaType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ public boolean matches(final MediaType that) {
373373
return true;
374374
}
375375
if (subtype.startsWith("*")) {
376-
return subtype.substring(1).endsWith(that.subtype);
376+
return that.subtype.endsWith(subtype.substring(2))
377+
|| that.subtype.endsWith(subtype.substring(1));
377378
}
378379
}
379380
return false;
@@ -425,7 +426,7 @@ public static MediaType valueOf(final String mediaType) {
425426
for (int i = 1; i < parts.length; i++) {
426427
String[] parameter = parts[i].split("=");
427428
if (parameter.length > 1) {
428-
parameters.put(parameter[0].trim(), parameter[1].trim());
429+
parameters.put(parameter[0].trim(), parameter[1].trim().toLowerCase());
429430
}
430431
}
431432
}

jooby-tests/src/test/java/jooby/AssetFeature.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class AssetFeature extends ServerFeature {
1515
@Test
1616
public void jsAsset() throws Exception {
1717
HttpResponse response = Request.Get(uri("/assets/file.js").build()).execute().returnResponse();
18-
assertEquals("application/javascript;charset=utf-8", response.getFirstHeader("Content-Type")
19-
.getValue());
18+
assertEquals("application/javascript; charset=utf-8", response.getFirstHeader("Content-Type")
19+
.getValue().toLowerCase());
2020
assertEquals(200, response.getStatusLine().getStatusCode());
2121
String lastModified = response.getFirstHeader("Last-Modified").getValue();
2222

@@ -29,8 +29,8 @@ public void jsAsset() throws Exception {
2929
@Test
3030
public void cssAsset() throws Exception {
3131
HttpResponse response = Request.Get(uri("/assets/file.css").build()).execute().returnResponse();
32-
assertEquals("text/css;charset=utf-8", response.getFirstHeader("Content-Type")
33-
.getValue());
32+
assertEquals("text/css; charset=utf-8", response.getFirstHeader("Content-Type")
33+
.getValue().toLowerCase());
3434
assertEquals(200, response.getStatusLine().getStatusCode());
3535
String lastModified = response.getFirstHeader("Last-Modified").getValue();
3636

0 commit comments

Comments
 (0)