From 70dabdbf398a7bbc7dcded2ceab3cf94a6b5b8b6 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 29 Jan 2018 14:33:02 +0000 Subject: [PATCH] Add application/json and /xml to default compressible mime types Closes gh-11828 --- .../org/springframework/boot/web/server/Compression.java | 5 +++-- .../springframework/boot/web/server/CompressionTests.java | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/Compression.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/Compression.java index 0857fabdf19..fe4991781b2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/Compression.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/Compression.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,8 @@ public class Compression { * Comma-separated list of MIME types that should be compressed. */ private String[] mimeTypes = new String[] { "text/html", "text/xml", "text/plain", - "text/css", "text/javascript", "application/javascript" }; + "text/css", "text/javascript", "application/javascript", "application/json", + "application/xml" }; /** * Comma-separated list of user agents for which responses should not be compressed. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/CompressionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/CompressionTests.java index 4f4914e634d..2a0ea9f5e34 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/CompressionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/CompressionTests.java @@ -20,7 +20,6 @@ import org.apache.coyote.http11.Http11NioProtocol; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides; import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +30,6 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @RunWith(ModifiedClassPathRunner.class) -@ClassPathOverrides("org.apache.tomcat.embed:tomcat-embed-core:8.5.24") public class CompressionTests { @Test