Updates for framework changes

This commit is contained in:
sgibb
2024-08-07 12:18:09 -04:00
parent 2bbfdceb62
commit bef29b69f8
2 changed files with 12 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.cloud.gateway.mvc.config;
import java.io.IOException;
import java.net.URI;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -32,6 +33,8 @@ import org.springframework.cloud.gateway.mvc.ProxyExchange;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.web.client.DefaultResponseErrorHandler;
@@ -94,6 +97,13 @@ public class ProxyResponseAutoConfiguration implements WebMvcConfigurer {
public void handleError(ClientHttpResponse response) throws IOException {
}
@Override
public void handleError(URI url, HttpMethod method, ClientHttpResponse response) throws IOException {
}
@Override
protected void handleError(ClientHttpResponse response, HttpStatusCode statusCode, URI url, HttpMethod method) throws IOException {
}
}
}

View File

@@ -153,7 +153,7 @@ public class ProductionConfigurationTests {
@Test
public void postForwardBody() {
ResponseEntity<String> result = rest
.exchange(RequestEntity.post(rest.getRestTemplate().getUriTemplateHandler().expand("/forward/body/bars"))
.exchange(RequestEntity.post(rest.getRestTemplate().getUriTemplateHandler().expand("/forward/body/bars")).accept(MediaType.APPLICATION_JSON)
.body(Collections.singletonList(Collections.singletonMap("name", "foo"))), String.class);
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(result.getBody()).contains("foo");
@@ -162,7 +162,7 @@ public class ProductionConfigurationTests {
@Test
public void postForwardForgetBody() {
ResponseEntity<String> result = rest
.exchange(RequestEntity.post(rest.getRestTemplate().getUriTemplateHandler().expand("/forward/forget/bars"))
.exchange(RequestEntity.post(rest.getRestTemplate().getUriTemplateHandler().expand("/forward/forget/bars")).accept(MediaType.APPLICATION_JSON)
.body(Collections.singletonList(Collections.singletonMap("name", "foo"))), String.class);
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(result.getBody()).contains("foo");