MockHttpServletResponse.setIntHeader supports 'Content-Length' header as well
Issue: SPR-13752
(cherry picked from commit a4f5c46)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -122,6 +122,13 @@ public class MockHttpServletResponseTests {
|
||||
assertEquals("66", response.getHeader("Content-Length"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contentLengthIntHeader() {
|
||||
response.addIntHeader("Content-Length", 66);
|
||||
assertEquals(66, response.getContentLength());
|
||||
assertEquals("66", response.getHeader("Content-Length"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void httpHeaderNameCasingIsPreserved() throws Exception {
|
||||
final String headerName = "Header1";
|
||||
@@ -221,20 +228,14 @@ public class MockHttpServletResponseTests {
|
||||
assertEquals(redirectUrl, response.getRedirectedUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* SPR-10414
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-10414
|
||||
public void modifyStatusAfterSendError() throws IOException {
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
assertEquals(response.getStatus(),HttpServletResponse.SC_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* SPR-10414
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-10414
|
||||
@SuppressWarnings("deprecation")
|
||||
public void modifyStatusMessageAfterSendError() throws IOException {
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
|
||||
Reference in New Issue
Block a user