private void contentType(MockHttpServletRequest request) { String contentType = header("Content-Type"); if (contentType == null) { FormEncodingType encodingType = this.webRequest.getEncodingType(); if (encodingType != null) { contentType = encodingType.getName(); } } request.setContentType(contentType != null ? contentType : MediaType.ALL_VALUE); }
private void contentType(WebTestClient.RequestBodySpec request, WebRequest webRequest) { String contentType = header("Content-Type", webRequest); if (contentType == null) { FormEncodingType encodingType = webRequest.getEncodingType(); if (encodingType != null) { contentType = encodingType.getName(); } } MediaType mediaType = contentType == null ? MediaType.ALL : MediaType.parseMediaType(contentType); request.contentType(mediaType); }
public void beforeRequest(WebRequest webRequest) { System.out.println("-----------Snooping HtmlUnit Request---------------------------"); System.out.println("url=" + webRequest.getUrl()); System.out.println("method=" + webRequest.getHttpMethod()); System.out.println("encoding=" + webRequest.getEncodingType()); System.out.println(); System.out.println("Additional Headers:"); Map<String, String> addlHeaders = webRequest.getAdditionalHeaders(); for (Iterator<String> i = addlHeaders.keySet().iterator(); i.hasNext(); ) { String name = i.next(); System.out.println(name + "=" + addlHeaders.get(name)); } System.out.println(); System.out.println("Request Params:"); for (Iterator i = webRequest.getRequestParameters().iterator(); i.hasNext();) { NameValuePair pair = (NameValuePair)i.next(); System.out.println(pair.getName() + "=" + pair.getValue()); } System.out.println("---------------------------------------------------------------"); }
public HtmlUnitInProcRequest(WebRequest request) { this.request = request; headers.put("Host", UrlHelper.getRequestHost(request.getUrl())); headers.put("Content-Type", request.getEncodingType().getName() + ";" + request.getCharset()); headers.putAll(request.getAdditionalHeaders()); }
public HtmlUnitInProcRequest(WebRequest request) { this.request = request; headers.put("Host", UrlHelper.getRequestHost(request.getUrl())); headers.put("Content-Type", request.getEncodingType().getName() + ";" + request.getCharset()); headers.putAll(request.getAdditionalHeaders()); }
private void contentType(MockHttpServletRequest request) { String contentType = header("Content-Type"); if (contentType == null) { FormEncodingType encodingType = this.webRequest.getEncodingType(); if (encodingType != null) { contentType = encodingType.getName(); } } request.setContentType(contentType != null ? contentType : MediaType.ALL_VALUE); }
private void contentType(MockHttpServletRequest request) { String contentType = header("Content-Type"); if (contentType == null) { FormEncodingType encodingType = this.webRequest.getEncodingType(); if (encodingType != null) { contentType = encodingType.getName(); } } request.setContentType(contentType != null ? contentType : MediaType.ALL_VALUE); }
bduiler.append("contentType: '" + response.getContentType() + "', "); bduiler.append("method: '" + request.getHttpMethod().name() + "', "); if (request.getHttpMethod() == HttpMethod.POST && request.getEncodingType() == FormEncodingType.URL_ENCODED) { bduiler.append("postParameters: " + nameValueListToJsMap(request.getRequestParameters()) + ", ");
.append("contentType: '" + response.getContentType() + "', ") .append("method: '" + request.getHttpMethod().name() + "', "); if (request.getHttpMethod() == HttpMethod.POST && request.getEncodingType() == FormEncodingType.URL_ENCODED) { bduiler.append("postParameters: " + nameValueListToJsMap(request.getRequestParameters()) + ", ");
final HttpEntityEnclosingRequest method = (HttpEntityEnclosingRequest) httpMethod; if (webRequest.getEncodingType() == FormEncodingType.URL_ENCODED && method instanceof HttpPost) { final HttpPost postMethod = (HttpPost) method; if (webRequest.getRequestBody() == null) { else if (FormEncodingType.MULTIPART == webRequest.getEncodingType()) { final Charset c = getCharset(charset, webRequest.getRequestParameters()); final MultipartEntityBuilder builder = MultipartEntityBuilder.create().setLaxMode();
final HttpEntityEnclosingRequest method = (HttpEntityEnclosingRequest) httpMethod; if (webRequest.getEncodingType() == FormEncodingType.URL_ENCODED && method instanceof HttpPost) { final HttpPost postMethod = (HttpPost) method; if (webRequest.getRequestBody() == null) { else if (FormEncodingType.MULTIPART == webRequest.getEncodingType()) { final Charset c = getCharset(charset, webRequest.getRequestParameters()); final MultipartEntityBuilder builder = MultipartEntityBuilder.create().setLaxMode();