Skip to content

Commit

Permalink
Test against latest Framework 5.1 snapshot
Browse files Browse the repository at this point in the history
This updates REST Docs to test against Framework's latest 5.1
snapshot. Due to a bug in the behaviour of HttpHeaders' key set [1],
HeaderRemovingOperationPreprocessor has been updated to no longer use
it when removing headers from a request or response prior to it being
documented.

[1] spring-projects/spring-framework#22821
  • Loading branch information
wilkinsona committed Sep 14, 2019
1 parent 4bbc5b3 commit ef0973c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion spring-restdocs-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ test {
matrixTest {
springFramework {
group = 'org.springframework'
versions = ['5.1.0.BUILD-SNAPSHOT']
versions = ['5.1.10.BUILD-SNAPSHOT']
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

package org.springframework.restdocs.operation.preprocess;

import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;

import org.springframework.http.HttpHeaders;
import org.springframework.restdocs.operation.OperationRequest;
Expand Down Expand Up @@ -55,11 +56,9 @@ public OperationRequest preprocess(OperationRequest request) {

private HttpHeaders removeHeaders(HttpHeaders originalHeaders) {
HttpHeaders processedHeaders = new HttpHeaders();
processedHeaders.putAll(originalHeaders);
Iterator<String> headers = processedHeaders.keySet().iterator();
while (headers.hasNext()) {
if (this.headerFilter.excludeHeader(headers.next())) {
headers.remove();
for (Entry<String, List<String>> header : originalHeaders.entrySet()) {
if (!this.headerFilter.excludeHeader(header.getKey())) {
processedHeaders.put(header.getKey(), header.getValue());
}
}
return processedHeaders;
Expand Down
2 changes: 1 addition & 1 deletion spring-restdocs-mockmvc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ test {
matrixTest {
springFramework {
group = 'org.springframework'
versions = ['5.1.0.BUILD-SNAPSHOT']
versions = ['5.1.10.BUILD-SNAPSHOT']
}
}
2 changes: 1 addition & 1 deletion spring-restdocs-webtestclient/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ test {
matrixTest {
springFramework {
group = 'org.springframework'
versions = ['5.1.0.BUILD-SNAPSHOT']
versions = ['5.1.10.BUILD-SNAPSHOT']
}
}

0 comments on commit ef0973c

Please sign in to comment.