@@ -79,26 +79,26 @@ public MultipartRequestEntity(Part[] parts, FluentCaseInsensitiveStringsMap requ
79
79
this.parts = parts;
80
80
String contentTypeHeader = requestHeaders.getFirstValue("Content-Type");
81
81
if (isNonEmpty(contentTypeHeader)) {
82
- int boundaryLocation = contentTypeHeader.indexOf("boundary=");
83
- if (boundaryLocation != -1) {
84
- // boundary defined in existing Content-Type
85
- contentType = contentTypeHeader;
86
- multipartBoundary = MultipartEncodingUtil.getAsciiBytes((contentTypeHeader.substring(boundaryLocation + "boundary=".length()).trim()));
87
- } else {
88
- // generate boundary and append it to existing Content-Type
89
- multipartBoundary = generateMultipartBoundary();
82
+ int boundaryLocation = contentTypeHeader.indexOf("boundary=");
83
+ if (boundaryLocation != -1) {
84
+ // boundary defined in existing Content-Type
85
+ contentType = contentTypeHeader;
86
+ multipartBoundary = MultipartEncodingUtil.getAsciiBytes((contentTypeHeader.substring(boundaryLocation + "boundary=".length()).trim()));
87
+ } else {
88
+ // generate boundary and append it to existing Content-Type
89
+ multipartBoundary = generateMultipartBoundary();
90
90
contentType = computeContentType(contentTypeHeader);
91
- }
91
+ }
92
92
} else {
93
- multipartBoundary = generateMultipartBoundary();
93
+ multipartBoundary = generateMultipartBoundary();
94
94
contentType = computeContentType(MULTIPART_FORM_CONTENT_TYPE);
95
95
}
96
96
}
97
97
98
98
private String computeContentType(String base) {
99
- StringBuilder buffer = new StringBuilder(base);
100
- if (!base.endsWith(";"))
101
- buffer.append(";");
99
+ StringBuilder buffer = new StringBuilder(base);
100
+ if (!base.endsWith(";"))
101
+ buffer.append(";");
102
102
return buffer.append(" boundary=").append(MultipartEncodingUtil.getAsciiString(multipartBoundary)).toString();
103
103
}
104
104
0 commit comments