updated for 1.2 support

This commit is contained in:
Tony Tam
2013-08-12 08:28:40 -07:00
parent b2637fc4bc
commit 4b5e4e5d69
6 changed files with 79 additions and 60 deletions

View File

@@ -32,7 +32,8 @@ class OperationView extends Backbone.View
contentTypeModel.produces = @model.produces
for param in @model.parameters
if param.dataType.toLowerCase() == 'file'
type = param.type || param.dataType
if type.toLowerCase() == 'file'
if !contentTypeModel.consumes
console.log "set content type "
contentTypeModel.consumes = 'multipart/form-data'
@@ -84,6 +85,10 @@ class OperationView extends Backbone.View
if(o.value? && jQuery.trim(o.value).length > 0)
map[o.name] = encodeURI(o.value)
for o in form.find("textarea")
if(o.value? && jQuery.trim(o.value).length > 0)
map["body"] = o.value
opts.responseContentType = $("div select[name=responseContentType]", $(@el)).val()
opts.requestContentType = $("div select[name=parameterContentType]", $(@el)).val()