|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2024 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.
|
|
16 | 16 |
|
17 | 17 | package org.springframework.test.web.servlet.result;
|
18 | 18 |
|
19 |
| -import java.nio.charset.StandardCharsets; |
20 | 19 | import java.util.Collections;
|
21 | 20 | import java.util.Enumeration;
|
22 | 21 | import java.util.Map;
|
|
28 | 27 |
|
29 | 28 | import org.springframework.core.style.ToStringCreator;
|
30 | 29 | import org.springframework.http.HttpHeaders;
|
31 |
| -import org.springframework.http.MediaType; |
32 | 30 | import org.springframework.lang.Nullable;
|
33 | 31 | import org.springframework.mock.web.MockHttpServletRequest;
|
34 | 32 | import org.springframework.mock.web.MockHttpServletResponse;
|
@@ -250,9 +248,7 @@ protected void printResponse(MockHttpServletResponse response) throws Exception
|
250 | 248 | this.printer.printValue("Error message", response.getErrorMessage());
|
251 | 249 | this.printer.printValue("Headers", getResponseHeaders(response));
|
252 | 250 | this.printer.printValue("Content type", response.getContentType());
|
253 |
| - String body = (MediaType.APPLICATION_JSON_VALUE.equals(response.getContentType()) ? |
254 |
| - response.getContentAsString(StandardCharsets.UTF_8) : response.getContentAsString()); |
255 |
| - this.printer.printValue("Body", body); |
| 251 | + this.printer.printValue("Body", response.getContentAsString()); |
256 | 252 | this.printer.printValue("Forwarded URL", response.getForwardedUrl());
|
257 | 253 | this.printer.printValue("Redirected URL", response.getRedirectedUrl());
|
258 | 254 | printCookies(response.getCookies());
|
|
0 commit comments