File tree 5 files changed +10
-10
lines changed
main/java/org/springframework/restdocs
test/java/org/springframework/restdocs/cli
5 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ org.gradle.parallel=true
6
6
7
7
javaFormatVersion =0.0.39
8
8
jmustacheVersion =1.15
9
- springFrameworkVersion =6.0.0
9
+ springFrameworkVersion =6.0.14-SNAPSHOT
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2014-2022 the original author or authors.
2
+ * Copyright 2014-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
18
18
19
19
import java .net .URI ;
20
20
import java .util .Arrays ;
21
+ import java .util .Base64 ;
21
22
import java .util .Collection ;
22
23
import java .util .HashSet ;
23
24
import java .util .List ;
30
31
import org .springframework .restdocs .operation .OperationRequest ;
31
32
import org .springframework .restdocs .operation .OperationRequestPart ;
32
33
import org .springframework .restdocs .operation .RequestCookie ;
33
- import org .springframework .util .Base64Utils ;
34
34
35
35
/**
36
36
* An {@link OperationRequest} wrapper with methods that are useful when producing a
@@ -137,7 +137,7 @@ static boolean isBasicAuthHeader(List<String> value) {
137
137
}
138
138
139
139
static String decodeBasicAuthHeader (List <String > value ) {
140
- return new String (Base64Utils . decodeFromString (value .get (0 ).substring (6 )));
140
+ return new String (Base64 . getDecoder (). decode (value .get (0 ).substring (6 )));
141
141
}
142
142
143
143
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2014-2022 the original author or authors.
2
+ * Copyright 2014-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public OperationResponse preprocess(OperationResponse response) {
57
57
58
58
private HttpHeaders preprocess (HttpHeaders headers ) {
59
59
HttpHeaders modifiedHeaders = new HttpHeaders ();
60
- modifiedHeaders .putAll (headers );
60
+ modifiedHeaders .addAll (headers );
61
61
for (Modification modification : this .modifications ) {
62
62
modification .applyTo (modifiedHeaders );
63
63
}
Original file line number Diff line number Diff line change 17
17
package org .springframework .restdocs .cli ;
18
18
19
19
import java .io .IOException ;
20
+ import java .util .Base64 ;
20
21
21
22
import org .junit .Test ;
22
23
import org .junit .runner .RunWith ;
26
27
import org .springframework .http .MediaType ;
27
28
import org .springframework .restdocs .AbstractSnippetTests ;
28
29
import org .springframework .restdocs .templates .TemplateFormat ;
29
- import org .springframework .util .Base64Utils ;
30
30
31
31
import static org .assertj .core .api .Assertions .assertThat ;
32
32
@@ -261,7 +261,7 @@ public void multipartPost() throws IOException {
261
261
@ Test
262
262
public void basicAuthCredentialsAreSuppliedUsingUserOption () throws IOException {
263
263
new CurlRequestSnippet (this .commandFormatter ).document (this .operationBuilder .request ("http://localhost/foo" )
264
- .header (HttpHeaders .AUTHORIZATION , "Basic " + Base64Utils .encodeToString ("user:secret" .getBytes ()))
264
+ .header (HttpHeaders .AUTHORIZATION , "Basic " + Base64 . getEncoder () .encodeToString ("user:secret" .getBytes ()))
265
265
.build ());
266
266
assertThat (this .generatedSnippets .curlRequest ())
267
267
.is (codeBlock ("bash" ).withContent ("$ curl 'http://localhost/foo' -i -u 'user:secret' -X GET" ));
Original file line number Diff line number Diff line change 17
17
package org .springframework .restdocs .cli ;
18
18
19
19
import java .io .IOException ;
20
+ import java .util .Base64 ;
20
21
21
22
import org .junit .Test ;
22
23
import org .junit .runner .RunWith ;
26
27
import org .springframework .http .MediaType ;
27
28
import org .springframework .restdocs .AbstractSnippetTests ;
28
29
import org .springframework .restdocs .templates .TemplateFormat ;
29
- import org .springframework .util .Base64Utils ;
30
30
31
31
import static org .assertj .core .api .Assertions .assertThat ;
32
32
@@ -260,7 +260,7 @@ public void multipartPost() throws IOException {
260
260
@ Test
261
261
public void basicAuthCredentialsAreSuppliedUsingAuthOption () throws IOException {
262
262
new HttpieRequestSnippet (this .commandFormatter ).document (this .operationBuilder .request ("http://localhost/foo" )
263
- .header (HttpHeaders .AUTHORIZATION , "Basic " + Base64Utils .encodeToString ("user:secret" .getBytes ()))
263
+ .header (HttpHeaders .AUTHORIZATION , "Basic " + Base64 . getEncoder () .encodeToString ("user:secret" .getBytes ()))
264
264
.build ());
265
265
assertThat (this .generatedSnippets .httpieRequest ())
266
266
.is (codeBlock ("bash" ).withContent ("$ http --auth 'user:secret' GET 'http://localhost/foo'" ));
You can’t perform that action at this time.
0 commit comments