I have just started to fail after this change 9b30d46ff4653c411ee4c8edb89b9bafa11b2ee9.

My content type candidate is like this one:

if (CollectionUtils.isEmpty(acceptTypes)) {
        acceptTypes = Collections.singletonList(MediaType.ALL);
}

So, MediaType.ALL is really compatible with MediaType.APPLICATION_JSON, but it is wrong value for the Content-Type header:

java.lang.IllegalArgumentException: Content-Type cannot contain wildcard type '*'

    at org.springframework.util.Assert.isTrue(Assert.java:118)
    at org.springframework.http.HttpHeaders.setContentType(HttpHeaders.java:949)
    at org.springframework.http.converter.StringHttpMessageConverter.addDefaultHeaders(StringHttpMessageConverter.java:109)
    at org.springframework.http.converter.StringHttpMessageConverter.addDefaultHeaders(StringHttpMessageConverter.java:44)
    at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:211)

Any clues what to use instead of MediaType.ALL when no Accept header in the request?

Or maybe this fix should be improved to skip MediaType.ALL as it is done in the super class:

if (contentType == null || contentType.isWildcardType() || contentType.isWildcardSubtype()) {
        contentTypeToUse = getDefaultContentType(t);
}

Note that AbstractMessageConverterMethodProcessor is not used in Spring Integration. There logic in the HttpRequestHandlingMessagingGateway is like this: https://github.com/spring-projects/spring-integration/blob/master/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/HttpRequestHandlingMessagingGateway.java#L171

So, instead of falling back to the MediaType.APPLICATION_OCTET_STREAM we try to rely on the Content-Type populated by the converted which fits to the payload we would like to return into the response.

Originally based on discussion.

Comment From: rstoyanchev

Resolved via https://github.com/spring-projects/spring-framework/commit/9d963abb7dfb6b0d0a3f6d89a2e60ebd42268146 which erroneously refers to another issue.