@@ -339,7 +339,7 @@ Swagger.prototype._mapResponseBody = function(endpoint, env) {
339
339
} ;
340
340
341
341
Swagger . prototype . _mapRequestBody = function ( slRequestBody , requestTypes ) {
342
- if ( ! slRequestBody . body ) {
342
+ if ( _ . isEmpty ( slRequestBody . body ) ) {
343
343
return [ ] ;
344
344
}
345
345
var result = [ ] , body = jsonHelper . parse ( slRequestBody . body ) || { } ;
@@ -354,7 +354,7 @@ Swagger.prototype._mapRequestBody = function(slRequestBody, requestTypes) {
354
354
var regex = / \" t y p e \" : [ ] * \" f i l e \" | \" t y p e \" : [ ] * \" b i n a r y \" / ;
355
355
//export as formData only if schema includes file type property
356
356
if ( slRequestBody . body . match ( regex ) ||
357
- [ 'multipart/form-data' , 'application/x-www-form-urlencoded' ] . indexOf ( requestTypes [ 0 ] ) !== - 1 ) {
357
+ ( ! _ . isEmpty ( requestTypes ) && [ 'multipart/form-data' , 'application/x-www-form-urlencoded' ] . indexOf ( requestTypes [ 0 ] ) !== - 1 ) ) {
358
358
for ( var prop in body . properties ) {
359
359
param = body . properties [ prop ] ;
360
360
param . in = 'formData' ;
@@ -536,10 +536,7 @@ Swagger.prototype._mapEndpoints = function (swaggerDef, env) {
536
536
}
537
537
538
538
parameters = parameters . concat ( this . _mapQueryString ( endpoint . QueryString ) ) ;
539
-
540
- if ( ! _ . isEmpty ( requestTypes ) ) {
541
- parameters = parameters . concat ( this . _mapRequestBody ( endpoint . Body , requestTypes ) ) ;
542
- }
539
+ parameters = parameters . concat ( this . _mapRequestBody ( endpoint . Body , requestTypes ) ) ;
543
540
544
541
parameters = parameters . concat ( this . _mapRequestHeaders ( endpoint . Headers ) ) ;
545
542
parameters = parameters . concat ( this . _mapEndpointTraitParameters ( endpoint , parameters ) ) ;
0 commit comments