/** * Create a {@link MockHttpServletRequestBuilder} for a HEAD request. * @param uri the URL * @return the builder for the HEAD request */ public static MockHttpServletRequestBuilder head(URI uri) { return MockMvcRequestBuilders.head(uri); }
@Test public void headWhenCsrfElementEnabledThenOk() throws Exception { this.spring.configLocations( this.xml("shared-controllers"), this.xml("CsrfEnabled") ).autowire(); this.mvc.perform(head("/csrf-in-header")) .andExpect(csrfInHeader()); }
@Test public void headWhenDefaultConfigurationThenCsrfIsEnabled() throws Exception { this.spring.configLocations( this.xml("shared-controllers"), this.xml("AutoConfig") ).autowire(); this.mvc.perform(head("/csrf-in-header")) .andExpect(csrfInHeader()); }
/** * Create a {@link MockHttpServletRequestBuilder} for a HEAD request. The url template * will be captured and made available for documentation. * @param urlTemplate a URL template; the resulting URL will be encoded * @param urlVariables zero or more URL variables * @return the builder for the HEAD request */ public static MockHttpServletRequestBuilder head(String urlTemplate, Object... urlVariables) { return MockMvcRequestBuilders.head(urlTemplate, urlVariables).requestAttr( RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE, urlTemplate); }
/** * Create a {@link MockHttpServletRequestBuilder} for a HEAD request. * @param uri the URL * @return the builder for the HEAD request */ public static MockHttpServletRequestBuilder head(URI uri) { return MockMvcRequestBuilders.head(uri); }
/** * Create a {@link MockHttpServletRequestBuilder} for a HEAD request. The url template * will be captured and made available for documentation. * @param urlTemplate a URL template; the resulting URL will be encoded * @param urlVariables zero or more URL variables * @return the builder for the HEAD request */ public static MockHttpServletRequestBuilder head(String urlTemplate, Object... urlVariables) { return MockMvcRequestBuilders.head(urlTemplate, urlVariables).requestAttr( RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE, urlTemplate); }