Start building against Spring Framework 6.0.14 snapshots
See gh-904 Closes gh-906
This commit is contained in:
@@ -6,4 +6,4 @@ org.gradle.parallel=true
|
||||
|
||||
javaFormatVersion=0.0.39
|
||||
jmustacheVersion=1.15
|
||||
springFrameworkVersion=6.0.0
|
||||
springFrameworkVersion=6.0.14-SNAPSHOT
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.restdocs.cli;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -30,7 +31,6 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.restdocs.operation.OperationRequest;
|
||||
import org.springframework.restdocs.operation.OperationRequestPart;
|
||||
import org.springframework.restdocs.operation.RequestCookie;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
/**
|
||||
* An {@link OperationRequest} wrapper with methods that are useful when producing a
|
||||
@@ -137,7 +137,7 @@ final class CliOperationRequest implements OperationRequest {
|
||||
}
|
||||
|
||||
static String decodeBasicAuthHeader(List<String> value) {
|
||||
return new String(Base64Utils.decodeFromString(value.get(0).substring(6)));
|
||||
return new String(Base64.getDecoder().decode(value.get(0).substring(6)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
* Copyright 2014-2023 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.
|
||||
@@ -57,7 +57,7 @@ public class HeadersModifyingOperationPreprocessor implements OperationPreproces
|
||||
|
||||
private HttpHeaders preprocess(HttpHeaders headers) {
|
||||
HttpHeaders modifiedHeaders = new HttpHeaders();
|
||||
modifiedHeaders.putAll(headers);
|
||||
modifiedHeaders.addAll(headers);
|
||||
for (Modification modification : this.modifications) {
|
||||
modification.applyTo(modifiedHeaders);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.restdocs.cli;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -26,7 +27,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.restdocs.AbstractSnippetTests;
|
||||
import org.springframework.restdocs.templates.TemplateFormat;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -261,7 +261,7 @@ public class CurlRequestSnippetTests extends AbstractSnippetTests {
|
||||
@Test
|
||||
public void basicAuthCredentialsAreSuppliedUsingUserOption() throws IOException {
|
||||
new CurlRequestSnippet(this.commandFormatter).document(this.operationBuilder.request("http://localhost/foo")
|
||||
.header(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString("user:secret".getBytes()))
|
||||
.header(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString("user:secret".getBytes()))
|
||||
.build());
|
||||
assertThat(this.generatedSnippets.curlRequest())
|
||||
.is(codeBlock("bash").withContent("$ curl 'http://localhost/foo' -i -u 'user:secret' -X GET"));
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.restdocs.cli;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -26,7 +27,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.restdocs.AbstractSnippetTests;
|
||||
import org.springframework.restdocs.templates.TemplateFormat;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -260,7 +260,7 @@ public class HttpieRequestSnippetTests extends AbstractSnippetTests {
|
||||
@Test
|
||||
public void basicAuthCredentialsAreSuppliedUsingAuthOption() throws IOException {
|
||||
new HttpieRequestSnippet(this.commandFormatter).document(this.operationBuilder.request("http://localhost/foo")
|
||||
.header(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString("user:secret".getBytes()))
|
||||
.header(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString("user:secret".getBytes()))
|
||||
.build());
|
||||
assertThat(this.generatedSnippets.httpieRequest())
|
||||
.is(codeBlock("bash").withContent("$ http --auth 'user:secret' GET 'http://localhost/foo'"));
|
||||
|
||||
Reference in New Issue
Block a user