@Test public void contentTypeHeaderUTF8() { String contentType = "test/plain;charset=UTF-8"; request.addHeader("Content-Type", contentType); assertEquals(contentType, request.getContentType()); assertEquals(contentType, request.getHeader("Content-Type")); assertEquals("UTF-8", request.getCharacterEncoding()); }
@Test public void setCharacterEncodingThenContentType() { request.setCharacterEncoding("UTF-8"); request.setContentType("test/plain"); assertEquals("test/plain", request.getContentType()); assertEquals("test/plain;charset=UTF-8", request.getHeader("Content-Type")); assertEquals("UTF-8", request.getCharacterEncoding()); }
@Test public void contentTypeHeader() { String contentType = "test/plain"; request.addHeader("Content-Type", contentType); assertEquals(contentType, request.getContentType()); assertEquals(contentType, request.getHeader("Content-Type")); assertNull(request.getCharacterEncoding()); }