content type 설정 수정

master
mjkhan21 1 year ago
parent 63df12a22d
commit f35b0ba597

@ -258,7 +258,7 @@ public class WebClient {
if (Assert.isEmpty(type)) return null;
for (ContentType content: values())
if (type.equals(content.type))
if (type.contains(content.type))
return content;
throw new IllegalArgumentException(type);
@ -296,7 +296,7 @@ public class WebClient {
}
public Request contentType(ContentType type) {
return header("Content-Type", type.type);
return header("Content-Type", type.type + "; charset=" + charset);
}
private Request.ContentType contentType() {
@ -430,10 +430,6 @@ public class WebClient {
HttpRequest.Builder builder = HttpRequest.newBuilder(URI.create(uri + queryString))
.GET();
ContentType contentType = contentType();
if (contentType != null)
builder.header("Content-Type", contentType.type + "; charset=" + charset);
if (headers != null)
headers.forEach((k, v) -> builder.header(k, v));
@ -466,11 +462,8 @@ public class WebClient {
HttpRequest post() {
try {
ContentType contentType = contentType();
HttpRequest.Builder builder = HttpRequest.newBuilder(URI.create(uri));
if (contentType != null)
builder.header("Content-Type", contentType.type + "; charset=" + charset);
builder.POST(bodyPublisher(contentType));
builder.POST(bodyPublisher(contentType()));
if (headers != null)
headers.forEach((k, v) -> builder.header(k, v));

Loading…
Cancel
Save