提交 c6a65527 编写于 作者: R Rossen Stoyanchev

Allow overriding of FormHttpMessageWriter#getMediaType

Closes gh-22588
上级 0e9ea2c9
/*
* 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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册