Skip to content

Commit 93ab9c2

Browse files
committed
Send default content type when none is specified.
1 parent 48f3c72 commit 93ab9c2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

httprpc-client/src/main/java/org/httprpc/WebServiceProxy.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,14 @@ public void encodeRequest(OutputStream outputStream) throws IOException {
513513
// Write request body
514514
if (requestHandler != null) {
515515
connection.setDoOutput(true);
516-
connection.setRequestProperty("Content-Type", requestHandler.getContentType());
516+
517+
String contentType = requestHandler.getContentType();
518+
519+
if (contentType == null) {
520+
contentType = "application/octet-stream";
521+
}
522+
523+
connection.setRequestProperty("Content-Type", contentType);
517524

518525
try (OutputStream outputStream = connection.getOutputStream()) {
519526
requestHandler.encodeRequest(outputStream);

0 commit comments

Comments
 (0)