Allow overriding of FormHttpMessageWriter#getMediaType
Closes gh-22588
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -127,8 +127,7 @@ public class FormHttpMessageWriter extends LoggingCodecSupport
|
||||
mediaType = getMediaType(mediaType);
|
||||
message.getHeaders().setContentType(mediaType);
|
||||
|
||||
Charset charset = mediaType.getCharset();
|
||||
Assert.notNull(charset, "No charset"); // should never occur
|
||||
Charset charset = mediaType.getCharset() != null ? mediaType.getCharset() : getDefaultCharset();
|
||||
|
||||
return Mono.from(inputStream).flatMap(form -> {
|
||||
logFormData(form, hints);
|
||||
@@ -140,7 +139,7 @@ public class FormHttpMessageWriter extends LoggingCodecSupport
|
||||
});
|
||||
}
|
||||
|
||||
private MediaType getMediaType(@Nullable MediaType mediaType) {
|
||||
protected MediaType getMediaType(@Nullable MediaType mediaType) {
|
||||
if (mediaType == null) {
|
||||
return DEFAULT_FORM_DATA_MEDIA_TYPE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user