Protected getContentType in DecoderHttpMessageReader
Issue: SPR-16856
This commit is contained in:
@@ -93,7 +93,15 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
|
||||
return this.decoder.decodeToMono(message.getBody(), elementType, contentType, hints);
|
||||
}
|
||||
|
||||
private MediaType getContentType(HttpMessage inputMessage) {
|
||||
/**
|
||||
* Determine the Content-Type of the HTTP message based on the
|
||||
* "Content-Type" header or otherwise default to
|
||||
* {@link MediaType#APPLICATION_OCTET_STREAM}.
|
||||
* @param inputMessage the HTTP message
|
||||
* @return the MediaType, possibly {@code null}.
|
||||
*/
|
||||
@Nullable
|
||||
protected MediaType getContentType(HttpMessage inputMessage) {
|
||||
MediaType contentType = inputMessage.getHeaders().getContentType();
|
||||
return (contentType != null ? contentType : MediaType.APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
|
||||
@@ -120,6 +120,13 @@ public class HttpMessageConverterExtractor<T> implements ResponseExtractor<T> {
|
||||
"for response type [" + this.responseType + "] and content type [" + contentType + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the Content-Type of the response based on the "Content-Type"
|
||||
* header or otherwise default to {@link MediaType#APPLICATION_OCTET_STREAM}.
|
||||
* @param response the response
|
||||
* @return the MediaType, possibly {@code null}.
|
||||
*/
|
||||
@Nullable
|
||||
protected MediaType getContentType(ClientHttpResponse response) {
|
||||
MediaType contentType = response.getHeaders().getContentType();
|
||||
if (contentType == null) {
|
||||
|
||||
Reference in New Issue
Block a user