Skip to content

Commit c85d7c6

Browse files
committed
start of file support
1 parent d8d0604 commit c85d7c6

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

lib/swagger.js

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
],
1010
"description": "swagger.js is a javascript client for use with swaggering APIs.",
11-
"version": "2.0.2",
11+
"version": "2.0.3",
1212
"homepage": "http://swagger.wordnik.com",
1313
"repository": {
1414
"type": "git",
@@ -24,7 +24,7 @@
2424
"node": ">= 0.6.6"
2525
},
2626
"dependencies": {
27-
"shred": "0.8.8"
27+
"shred": "0.8.9"
2828
},
2929
"devDependencies": {
3030
"coffee-script": "~1.5.0"

src/swagger.coffee

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ class SwaggerOperation
500500
delete args.body
501501

502502
# pull out any form params
503-
possibleParams = (param for param in @parameters when param.paramType is "form")
503+
possibleParams = (param for param in @parameters when (param.paramType is "form" or param.paramType.toLowerCase() is "file" ))
504504
if possibleParams
505505
for key, value of possibleParams
506506
if args[value.name]
@@ -601,7 +601,10 @@ class SwaggerRequest
601601
else
602602
# if any form params
603603
if (param for param in @operation.parameters when param.paramType is "form").length > 0
604-
requestContentType = "application/x-www-form-urlencoded"
604+
if (param for param in @operation.parameters when param.dataType.toLowerCase() is "file").length > 0
605+
requestContentType = "multipart/form-data"
606+
else
607+
requestContentType = "application/x-www-form-urlencoded"
605608
else if @type isnt "DELETE"
606609
requestContentType = null
607610

0 commit comments

Comments
 (0)