Search in sources :

Example 6 with FormEncodingType

use of com.gargoylesoftware.htmlunit.FormEncodingType in project spring-security by spring-projects.

the class HtmlUnitWebTestClient method contentType.

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.parseMediaType(contentType) : MediaType.ALL;
    request.contentType(mediaType);
}
Also used : FormEncodingType(com.gargoylesoftware.htmlunit.FormEncodingType) MediaType(org.springframework.http.MediaType)

Aggregations

FormEncodingType (com.gargoylesoftware.htmlunit.FormEncodingType)6 MediaType (org.springframework.http.MediaType)1