modules/spring-commons/src/main/java/io/restassured/module/spring/commons/HeaderHelper.java
public static String findContentType(Headers headers, List<Object> multiParts, SpecificationConfig config) {
        String requestContentType = headers.getValue(CONTENT_TYPE);
        if (StringUtils.isBlank(requestContentType) && !multiParts.isEmpty()) {
            requestContentType = "multipart/" + config.getMultiPartConfig().defaultSubtype();
        }

        EncoderConfig encoderConfig = config.getEncoderConfig();
        if (requestContentType != null && encoderConfig.shouldAppendDefaultContentCharsetToContentTypeIfUndefined() && !StringUtils.containsIgnoreCase(requestContentType, CHARSET)) {
            // Append default charset to request content type
            requestContentType += "; charset=";
            if (encoderConfig.hasDefaultCharsetForContentType(requestContentType)) {
                requestContentType += encoderConfig.defaultCharsetForContentType(requestContentType);
            } else {
                requestContentType += encoderConfig.defaultContentCharset();
            }
        }
        return requestContentType;
    }
public static String findContentType(Headers headers, List<Object> multiParts, SpecificationConfig config) {
        String requestContentType = headers.getValue(CONTENT_TYPE);
        if (StringUtils.isBlank(requestContentType) && !multiParts.isEmpty()) {
            requestContentType = "multipart/" + config.getMultiPartConfig().defaultSubtype();
        }

        EncoderConfig encoderConfig = config.getEncoderConfig();
        if (requestContentType != null && encoderConfig.shouldAppendDefaultContentCharsetToContentTypeIfUndefined() && !StringUtils.containsIgnoreCase(requestContentType, CHARSET)) {
            // Append default charset to request content type
            requestContentType += "; charset=";
            if (encoderConfig.hasDefaultCharsetForContentType(requestContentType)) {
                requestContentType += encoderConfig.defaultCharsetForContentType(requestContentType);
            } else {
                requestContentType += encoderConfig.defaultContentCharset();
            }
        }
        return requestContentType;
    }
public static String findContentType ( Headers headers , List < Object > multiParts , SpecificationConfig config ) { String requestContentType = headers . getValue ( CONTENT_TYPE ) ; if ( StringUtils . isBlank ( requestContentType ) && ! multiParts . isEmpty ( ) ) { requestContentType = "multipart/" + config . getMultiPartConfig ( ) . defaultSubtype ( ) ; } EncoderConfig encoderConfig = config . getEncoderConfig ( ) ; if ( requestContentType != null && encoderConfig . shouldAppendDefaultContentCharsetToContentTypeIfUndefined ( ) && ! StringUtils . containsIgnoreCase ( requestContentType , CHARSET ) ) { // Append default charset to request content type requestContentType += "; charset=" ; if ( encoderConfig . hasDefaultCharsetForContentType ( requestContentType ) ) { requestContentType += encoderConfig . defaultCharsetForContentType ( requestContentType ) ; } else { requestContentType += encoderConfig . defaultContentCharset ( ) ; } } return requestContentType ; }
TODO Extract content-type from headers and apply charset if needed!
TODO Extract content - type from headers and apply charset if needed!