Raise the minimum support version of Spring Framework to 7.0
See gh-955
This commit is contained in:
committed by
Andy Wilkinson
parent
db16f279c2
commit
c72e32d3cb
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
* Copyright 2014-2025 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.
|
||||
@@ -68,7 +68,7 @@ class MockMvcResponseConverter implements ResponseConverter<MockHttpServletRespo
|
||||
}
|
||||
}
|
||||
|
||||
if (response.getCookies() != null && !headers.containsKey(HttpHeaders.SET_COOKIE)) {
|
||||
if (response.getCookies() != null && !headers.containsHeader(HttpHeaders.SET_COOKIE)) {
|
||||
for (Cookie cookie : response.getCookies()) {
|
||||
headers.add(HttpHeaders.SET_COOKIE, generateSetCookieHeader(cookie));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2023 the original author or authors.
|
||||
* Copyright 2014-2025 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.
|
||||
@@ -37,6 +37,7 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilde
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.entry;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -78,8 +79,8 @@ public class MockMvcRequestConverterTests {
|
||||
MockMvcRequestBuilders.get("/foo").header("a", "alpha", "apple").header("b", "bravo"));
|
||||
assertThat(request.getUri()).isEqualTo(URI.create("http://localhost/foo"));
|
||||
assertThat(request.getMethod()).isEqualTo(HttpMethod.GET);
|
||||
assertThat(request.getHeaders()).containsEntry("a", Arrays.asList("alpha", "apple"));
|
||||
assertThat(request.getHeaders()).containsEntry("b", Arrays.asList("bravo"));
|
||||
assertThat(request.getHeaders().headerSet()).contains(entry("a", Arrays.asList("alpha", "apple")),
|
||||
entry("b", Arrays.asList("bravo")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
* Copyright 2014-2025 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.
|
||||
@@ -30,6 +30,7 @@ import org.springframework.restdocs.operation.OperationResponse;
|
||||
import org.springframework.restdocs.operation.ResponseCookie;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.entry;
|
||||
|
||||
/**
|
||||
* Tests for {@link MockMvcResponseConverter}.
|
||||
@@ -57,9 +58,8 @@ public class MockMvcResponseConverterTests {
|
||||
cookie.setHttpOnly(true);
|
||||
response.addCookie(cookie);
|
||||
OperationResponse operationResponse = this.factory.convert(response);
|
||||
assertThat(operationResponse.getHeaders()).hasSize(1);
|
||||
assertThat(operationResponse.getHeaders()).containsEntry(HttpHeaders.SET_COOKIE,
|
||||
Collections.singletonList("name=value; Domain=localhost; HttpOnly"));
|
||||
assertThat(operationResponse.getHeaders().headerSet()).containsOnly(
|
||||
entry(HttpHeaders.SET_COOKIE, Collections.singletonList("name=value; Domain=localhost; HttpOnly")));
|
||||
assertThat(operationResponse.getCookies()).hasSize(1);
|
||||
assertThat(operationResponse.getCookies()).first().extracting(ResponseCookie::getName).isEqualTo("name");
|
||||
assertThat(operationResponse.getCookies()).first().extracting(ResponseCookie::getValue).isEqualTo("value");
|
||||
|
||||
Reference in New Issue
Block a user