File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
modules/swagger-codegen/src/main/resources/Java Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import java.util.*;
11
11
{ {/imports} }
12
12
13
13
import com.sun.jersey.multipart.FormDataMultiPart;
14
+ import com.sun.jersey.multipart.file.FileDataBodyPart;
14
15
15
16
import javax.ws.rs.core.MediaType;
16
17
@@ -77,7 +78,8 @@ public class {{classname}} {
77
78
mp.field("{ {baseName} }", ApiInvoker.parameterToString({ {paramName} }), MediaType.MULTIPART_FORM_DATA_TYPE);
78
79
{ {/notFile} }{ {#isFile} }
79
80
hasFields = true;
80
- mp.field("{ {baseName} }", { {paramName} }, MediaType.MULTIPART_FORM_DATA_TYPE);
81
+ mp.field("{ {baseName} }", file.getName());
82
+ mp.bodyPart(new FileDataBodyPart("{ {baseName} }", { {paramName} }, MediaType.MULTIPART_FORM_DATA_TYPE));
81
83
{ {/isFile} }{ {/formParams} }
82
84
if(hasFields)
83
85
postBody = mp;
@@ -96,12 +98,7 @@ public class {{classname}} {
96
98
return {{#returnType} }null{ {/returnType} };
97
99
}
98
100
} catch (ApiException ex) {
99
- if (ex.getCode() == 404) {
100
- return {{#returnType} } null{ {/returnType} };
101
- }
102
- else {
103
- throw ex;
104
- }
101
+ throw ex;
105
102
}
106
103
}
107
104
{ {/operation} }
You can’t perform that action at this time.
0 commit comments