|
5 | 5 | * you may not use this file except in compliance with the License.
|
6 | 6 | * You may obtain a copy of the License at
|
7 | 7 | *
|
8 |
| - * http://www.apache.org/licensesch/LICENSE-2.0 |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
9 | 9 | *
|
10 | 10 | * Unless required by applicable law or agreed to in writing, software
|
11 | 11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -970,6 +970,7 @@ public void requestBodyResponseBody() throws ServletException, IOException {
|
970 | 970 | request.addHeader("Accept", "text/*");
|
971 | 971 | MockHttpServletResponse response = new MockHttpServletResponse();
|
972 | 972 | servlet.service(request, response);
|
| 973 | + assertEquals(200, response.getStatus()); |
973 | 974 | assertEquals(requestBody, response.getContentAsString());
|
974 | 975 | }
|
975 | 976 |
|
@@ -1016,6 +1017,20 @@ public void unsupportedRequestBody() throws ServletException, IOException {
|
1016 | 1017 | assertNotNull("No Accept response header set", response.getHeader("Accept"));
|
1017 | 1018 | }
|
1018 | 1019 |
|
| 1020 | + @Test |
| 1021 | + public void responseBodyNoAcceptHeader() throws ServletException, IOException { |
| 1022 | + initServlet(RequestBodyController.class); |
| 1023 | + |
| 1024 | + MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/something"); |
| 1025 | + String requestBody = "Hello World"; |
| 1026 | + request.setContent(requestBody.getBytes("UTF-8")); |
| 1027 | + request.addHeader("Content-Type", "text/plain; charset=utf-8"); |
| 1028 | + MockHttpServletResponse response = new MockHttpServletResponse(); |
| 1029 | + servlet.service(request, response); |
| 1030 | + assertEquals(200, response.getStatus()); |
| 1031 | + assertEquals(requestBody, response.getContentAsString()); |
| 1032 | + } |
| 1033 | + |
1019 | 1034 | @Test
|
1020 | 1035 | public void badRequestRequestBody() throws ServletException, IOException {
|
1021 | 1036 | @SuppressWarnings("serial") DispatcherServlet servlet = new DispatcherServlet() {
|
|
0 commit comments