forked from loafle/openapi-generator-original
Merge branch 'kartenkarsten-patch-1'
This commit is contained in:
commit
2943177d06
@ -497,9 +497,16 @@ public class ApiClient {
|
|||||||
if (contentType.startsWith("multipart/form-data")) {
|
if (contentType.startsWith("multipart/form-data")) {
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
for (Entry<String, Object> param: formParams.entrySet()) {
|
for (Entry<String, Object> param: formParams.entrySet()) {
|
||||||
if (param.getValue() instanceof File) {
|
if( param.getValue() instanceof List && !( ( List ) param.getValue() ).isEmpty()
|
||||||
|
&& ( ( List ) param.getValue() ).get( 0 ) instanceof File ) {
|
||||||
|
@SuppressWarnings( "unchecked" )
|
||||||
|
List<File> files = ( List<File> ) param.getValue();
|
||||||
|
for( File file : files ) {
|
||||||
|
mp.bodyPart( new FileDataBodyPart( param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE ) );
|
||||||
|
}
|
||||||
|
} else if (param.getValue() instanceof File) {
|
||||||
File file = (File) param.getValue();
|
File file = (File) param.getValue();
|
||||||
mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.MULTIPART_FORM_DATA_TYPE));
|
mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE));
|
||||||
} else {
|
} else {
|
||||||
mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE);
|
mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
}
|
}
|
||||||
|
@ -509,9 +509,16 @@ public class ApiClient {
|
|||||||
if (contentType.startsWith("multipart/form-data")) {
|
if (contentType.startsWith("multipart/form-data")) {
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
for (Entry<String, Object> param: formParams.entrySet()) {
|
for (Entry<String, Object> param: formParams.entrySet()) {
|
||||||
if (param.getValue() instanceof File) {
|
if( param.getValue() instanceof List && !( ( List ) param.getValue() ).isEmpty()
|
||||||
|
&& ( ( List ) param.getValue() ).get( 0 ) instanceof File ) {
|
||||||
|
@SuppressWarnings( "unchecked" )
|
||||||
|
List<File> files = ( List<File> ) param.getValue();
|
||||||
|
for( File file : files ) {
|
||||||
|
mp.bodyPart( new FileDataBodyPart( param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE ) );
|
||||||
|
}
|
||||||
|
} else if (param.getValue() instanceof File) {
|
||||||
File file = (File) param.getValue();
|
File file = (File) param.getValue();
|
||||||
mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.MULTIPART_FORM_DATA_TYPE));
|
mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE));
|
||||||
} else {
|
} else {
|
||||||
mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE);
|
mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user