File tree 1 file changed +6
-2
lines changed
spring-restdocs-core/src/main/java/org/springframework/restdocs/operation
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2014-2019 the original author or authors.
2
+ * Copyright 2014-2020 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.
17
17
package org .springframework .restdocs .operation ;
18
18
19
19
import java .nio .charset .Charset ;
20
+ import java .nio .charset .StandardCharsets ;
20
21
import java .util .Arrays ;
21
22
22
23
import org .springframework .http .HttpHeaders ;
@@ -52,7 +53,10 @@ public HttpHeaders getHeaders() {
52
53
public String getContentAsString () {
53
54
if (this .content .length > 0 ) {
54
55
Charset charset = extractCharsetFromContentTypeHeader ();
55
- return (charset != null ) ? new String (this .content , charset ) : new String (this .content );
56
+ if (charset == null ) {
57
+ charset = StandardCharsets .UTF_8 ;
58
+ }
59
+ return new String (this .content , charset );
56
60
}
57
61
return "" ;
58
62
}
You can’t perform that action at this time.
0 commit comments