List of usage examples for org.springframework.mock.web MockHttpServletRequest getContentType
@Override
@Nullable
public String getContentType()
From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTest.java
@Test public void buildRequestContentType() { String contentType = "text/html;charset=UTF-8"; webRequest.setAdditionalHeader("Content-Type", contentType); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); assertThat(actualRequest.getContentType()).isEqualTo(contentType); assertThat(actualRequest.getHeader("Content-Type")).isEqualTo(contentType); }
From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTests.java
@Test public void buildRequestContentType() { String contentType = "text/html;charset=UTF-8"; webRequest.setAdditionalHeader("Content-Type", contentType); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); assertThat(actualRequest.getContentType(), equalTo(contentType)); assertThat(actualRequest.getHeader("Content-Type"), equalTo(contentType)); }
From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTests.java
@Test // SPR-14916 public void buildRequestContentTypeWithFormSubmission() { webRequest.setEncodingType(FormEncodingType.URL_ENCODED); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); assertThat(actualRequest.getContentType(), equalTo("application/x-www-form-urlencoded")); assertThat(actualRequest.getHeader("Content-Type"), equalTo("application/x-www-form-urlencoded;charset=ISO-8859-1")); }