类的使用
cn.taketoday.test.web.servlet.request.MockHttpServletRequestBuilder
程序包
说明
Support for testing Web MVC applications via
WebTestClient
with MockMvc for server request
handling.Contains built-in
RequestBuilder
implementations.-
cn.taketoday.test.web.servlet.client中MockHttpServletRequestBuilder的使用
修饰符和类型方法说明private MockHttpServletRequestBuilderMockMvcHttpConnector.initRequestBuilder(cn.taketoday.http.HttpMethod httpMethod, URI uri, MockClientHttpRequest httpRequest, byte[] bytes) -
cn.taketoday.test.web.servlet.request中MockHttpServletRequestBuilder的使用
修饰符和类型方法说明MockHttpServletRequestBuilder.accept(cn.taketoday.http.MediaType... mediaTypes) Set the 'Accept' header to the given media type(s).Set theAcceptheader using raw String values, possibly not even well-formed (for testing purposes).MockHttpServletRequestBuilder.characterEncoding(String encoding) Set the character encoding of the request.MockHttpServletRequestBuilder.characterEncoding(Charset encoding) Set the character encoding of the request.MockHttpServletRequestBuilder.content(byte[] content) Set the request body.Set the request body as a UTF-8 String.MockHttpServletRequestBuilder.contentType(cn.taketoday.http.MediaType contentType) Set the 'Content-Type' header of the request.MockHttpServletRequestBuilder.contentType(String contentType) Set the 'Content-Type' header of the request as a raw String value, possibly not even well-formed (for testing purposes).MockHttpServletRequestBuilder.contextPath(String contextPath) Specify the portion of the requestURI that represents the context path.MockHttpServletRequestBuilder.cookie(jakarta.servlet.http.Cookie... cookies) Add the given cookies to the request.Create aMockHttpServletRequestBuilderfor a DELETE request.Create aMockHttpServletRequestBuilderfor a DELETE request.Set an "input" flash attribute.MockHttpServletRequestBuilder.flashAttrs(Map<String, Object> flashAttributes) Set flash attributes.Create aMockHttpServletRequestBuilderfor a GET request.Create aMockHttpServletRequestBuilderfor a GET request.Create aMockHttpServletRequestBuilderfor a HEAD request.Create aMockHttpServletRequestBuilderfor a HEAD request.Add a header to the request.MockHttpServletRequestBuilder.headers(cn.taketoday.http.HttpHeaders httpHeaders) Add all headers to the request.Set the locale of the request, overriding any previous locales.Add the specified locales as preferred request locales.Create aMockHttpServletRequestBuilderfor an OPTIONS request.Create aMockHttpServletRequestBuilderfor an OPTIONS request.Add a request parameter toMockHttpServletRequest.getParameterMap().Variant ofparam(String, String...)with aMultiValueMap.Create aMockHttpServletRequestBuilderfor a PATCH request.Create aMockHttpServletRequestBuilderfor a PATCH request.Specify the portion of the requestURI that represents the pathInfo.Create aMockHttpServletRequestBuilderfor a POST request.Create aMockHttpServletRequestBuilderfor a POST request.Set the principal of the request.Create aMockHttpServletRequestBuilderfor a PUT request.Create aMockHttpServletRequestBuilderfor a PUT request.MockHttpServletRequestBuilder.queryParam(String name, String... values) Append to the query string and also add to therequest parametersmap.MockHttpServletRequestBuilder.queryParams(cn.taketoday.util.MultiValueMap<String, String> params) Append to the query string and also add to therequest parametersmap.MockHttpServletRequestBuilder.remoteAddress(String remoteAddress) Set the remote address of the request.MockMvcRequestBuilders.request(cn.taketoday.http.HttpMethod method, String urlTemplate, Object... uriVariables) Create aMockHttpServletRequestBuilderfor a request with the given HTTP method.Create aMockHttpServletRequestBuilderfor a request with the given HTTP method.Alternative factory method that allows for custom HTTP verbs (e.g.MockHttpServletRequestBuilder.requestAttr(String name, Object value) Set a request attribute.MockHttpServletRequestBuilder.secure(boolean secure) Set the secure property of theServletRequestindicating use of a secure channel, such as HTTPS.MockHttpServletRequestBuilder.servletPath(String servletPath) Specify the portion of the requestURI that represents the path to which the Servlet is mapped.MockHttpServletRequestBuilder.session(MockHttpSession session) Set the HTTP session to use, possibly re-used across requests.MockHttpServletRequestBuilder.sessionAttr(String name, Object value) Set a session attribute.MockHttpServletRequestBuilder.sessionAttrs(Map<String, Object> sessionAttributes) Set session attributes.MockHttpServletRequestBuilder.with(RequestPostProcessor postProcessor) An extension point for further initialization ofMockHttpServletRequestin ways not built directly into theMockHttpServletRequestBuilder.