Compare commits

...

13 Commits
main ... 3.1.x

Author SHA1 Message Date
buildmaster d7a252d3bd Bumping versions 1 year ago
buildmaster cf5b1c9b82 Bumping versions to 3.1.10-SNAPSHOT after release 1 year ago
buildmaster 57aed14c28 Going back to snapshots 1 year ago
buildmaster dc327b79cf Update SNAPSHOT to 3.1.9 1 year ago
dependabot[bot] ba2201ee1a
Bump org.testcontainers:testcontainers-bom from 1.17.2 to 1.17.6 (#3080) 1 year ago
dependabot[bot] 215702320d
Bump mikepenz/action-junit-report from 2 to 4 (#3068) 1 year ago
buildmaster d9b7812c07 Bumping versions 1 year ago
sgibb 50413c4722
Updates includes to build 3.1.x branch 1 year ago
dependabot[bot] c13e802806
Bump actions/checkout from 3 to 4 (#3070) 1 year ago
sgibb c83e79397b
Adds antora bits to ignoreˆ 1 year ago
Gaurav Ojha e92bfcd5d3
Support spring.codec.max-in-memory-size configuration for CacheRequestBodyFilter 1 year ago
dependabot[bot] 6c856dbc06
Bump org.apache.maven.plugins:maven-jar-plugin from 3.2.0 to 3.2.2 (#3079) 1 year ago
dependabot[bot] 8c6f3693dd
Bump grpc.version from 1.47.0 to 1.47.1 (#3077) 1 year ago
  1. 4
      .github/workflows/maven.yml
  2. 6
      .gitignore
  3. 3
      README.adoc
  4. 4
      docs/src/main/asciidoc/README.adoc
  5. 2
      pom.xml
  6. 2
      spring-cloud-gateway-integration-tests/grpc/pom.xml
  7. 4
      spring-cloud-gateway-server/pom.xml
  8. 5
      spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/config/GatewayAutoConfiguration.java
  9. 5
      spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/factory/CacheRequestBodyGatewayFilterFactory.java
  10. 14
      spring-cloud-gateway-server/src/test/java/org/springframework/cloud/gateway/filter/factory/CacheRequestBodyGatewayFilterFactoryTests.java

4
.github/workflows/maven.yml

@ -15,7 +15,7 @@ jobs: @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
@ -31,7 +31,7 @@ jobs: @@ -31,7 +31,7 @@ jobs:
- name: Build with Maven
run: ./mvnw clean install -B -U -Pspring -Dmaven.test.redirectTestOutputToFile=true -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
uses: mikepenz/action-junit-report@v4
if: always() # always run even if the previous step fails
with:
report_paths: '**/surefire-reports/TEST-*.xml'

6
.gitignore vendored

@ -21,3 +21,9 @@ _site/ @@ -21,3 +21,9 @@ _site/
*.swo
.vscode/
.flattened-pom.xml
node
node_modules
build
package.json
package-lock.json

3
README.adoc

@ -27,8 +27,7 @@ This project provides an API Gateway built on top of the Spring Ecosystem, inclu @@ -27,8 +27,7 @@ This project provides an API Gateway built on top of the Spring Ecosystem, inclu
== Building
:jdkversion: 17
:jdkversion: 1.8
=== Basic Compile and Test

4
docs/src/main/asciidoc/README.adoc

@ -19,8 +19,8 @@ include::intro.adoc[] @@ -19,8 +19,8 @@ include::intro.adoc[]
== Building
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building-jdk8.adoc[]
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/3.1.x/docs/src/main/asciidoc/building-jdk8.adoc[]
== Contributing
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/3.1.x/docs/src/main/asciidoc/contributing.adoc[]

2
pom.xml

@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
<junit-pioneer.version>1.0.0</junit-pioneer.version>
<spring-cloud-circuitbreaker.version>2.1.8-SNAPSHOT</spring-cloud-circuitbreaker.version>
<spring-cloud-commons.version>3.1.8-SNAPSHOT</spring-cloud-commons.version>
<testcontainers.version>1.17.2</testcontainers.version>
<testcontainers.version>1.17.6</testcontainers.version>
<kotlin-maven-plugin.version>1.6.21</kotlin-maven-plugin.version>
</properties>

2
spring-cloud-gateway-integration-tests/grpc/pom.xml

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
<description>Spring Cloud Gateway gRPC Integration Test</description>
<properties>
<grpc.version>1.47.0</grpc.version>
<grpc.version>1.47.1</grpc.version>
</properties>
<parent>

4
spring-cloud-gateway-server/pom.xml

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<description>Spring Cloud Gateway Server</description>
<properties>
<main.basedir>${basedir}/..</main.basedir>
<grpc.version>1.47.0</grpc.version>
<grpc.version>1.47.1</grpc.version>
</properties>
<dependencies>
@ -223,7 +223,7 @@ @@ -223,7 +223,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.2.2</version>
<executions>
<execution>
<goals>

5
spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/config/GatewayAutoConfiguration.java

@ -514,8 +514,9 @@ public class GatewayAutoConfiguration { @@ -514,8 +514,9 @@ public class GatewayAutoConfiguration {
@Bean
@ConditionalOnEnabledFilter
public CacheRequestBodyGatewayFilterFactory cacheRequestBodyGatewayFilterFactory() {
return new CacheRequestBodyGatewayFilterFactory();
public CacheRequestBodyGatewayFilterFactory cacheRequestBodyGatewayFilterFactory(
ServerCodecConfigurer codecConfigurer) {
return new CacheRequestBodyGatewayFilterFactory(codecConfigurer.getReaders());
}
@Bean

5
spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/factory/CacheRequestBodyGatewayFilterFactory.java

@ -51,6 +51,11 @@ public class CacheRequestBodyGatewayFilterFactory @@ -51,6 +51,11 @@ public class CacheRequestBodyGatewayFilterFactory
this.messageReaders = HandlerStrategies.withDefaults().messageReaders();
}
public CacheRequestBodyGatewayFilterFactory(List<HttpMessageReader<?>> messageReaders) {
super(CacheRequestBodyGatewayFilterFactory.Config.class);
this.messageReaders = messageReaders;
}
@Override
public GatewayFilter apply(CacheRequestBodyGatewayFilterFactory.Config config) {
return new GatewayFilter() {

14
spring-cloud-gateway-server/src/test/java/org/springframework/cloud/gateway/filter/factory/CacheRequestBodyGatewayFilterFactoryTests.java

@ -34,7 +34,9 @@ import org.springframework.cloud.gateway.test.BaseWebClientTests; @@ -34,7 +34,9 @@ import org.springframework.cloud.gateway.test.BaseWebClientTests;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.buffer.PooledDataBuffer;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.util.StringUtils;
import org.springframework.web.server.ServerWebExchange;
@ -43,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@SpringBootTest(webEnvironment = RANDOM_PORT)
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = "spring.codec.max-in-memory-size=25")
@DirtiesContext
public class CacheRequestBodyGatewayFilterFactoryTests extends BaseWebClientTests {
@ -53,6 +55,8 @@ public class CacheRequestBodyGatewayFilterFactoryTests extends BaseWebClientTest @@ -53,6 +55,8 @@ public class CacheRequestBodyGatewayFilterFactoryTests extends BaseWebClientTest
private static final String BODY_CACHED_EXISTS = "BODY_CACHED_EXISTS";
private static final String LARGE_BODY_VALUE = "here is request body which will cause payload size failure";
@Test
public void cacheRequestBodyWorks() {
testClient.post().uri("/post").header("Host", "www.cacherequestbody.org").bodyValue(BODY_VALUE).exchange()
@ -65,6 +69,14 @@ public class CacheRequestBodyGatewayFilterFactoryTests extends BaseWebClientTest @@ -65,6 +69,14 @@ public class CacheRequestBodyGatewayFilterFactoryTests extends BaseWebClientTest
});
}
@Test
public void cacheRequestBodyDoesntWorkForLargePayload() {
testClient.post().uri("/post").header("Host", "www.cacherequestbody.org")
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).bodyValue(LARGE_BODY_VALUE)
.exchange().expectStatus().isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR).expectBody().jsonPath("message")
.isEqualTo("Exceeded limit on max bytes to buffer : 25");
}
@Test
public void cacheRequestBodyEmpty() {
testClient.post().uri("/post").header("Host", "www.cacherequestbodyempty.org").exchange().expectStatus().isOk()

Loading…
Cancel
Save