Skip to content

Commit

Permalink
Allow auto-typing to be configurable in multipart forms
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Aug 28, 2014
1 parent 69092d3 commit 02cf745
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions media/multipart-form-data.js
Expand Up @@ -41,7 +41,7 @@ var parseMultipart = typeof process == "undefined" ?
require("jsgi-node/jsgi/node").Node);


Media({
return Media({
mediaType:"multipart/form-data",
getQuality: function(object){
return 0.2;
Expand All @@ -61,7 +61,9 @@ Media({
"content-type": "multipart/form-data; boundary=" + boundary
}
},
autoType: true,
deserialize: function(inputStream, parameters, request){
var autoType = this.autoType;
return when(parseMultipart(request), function(form){
var files = [];
var fileKeys = [];
Expand All @@ -72,7 +74,7 @@ Media({
fileKeys.push(i);
}
else{
form[i] = stringToValue(value);
form[i] = autoType ? stringToValue(value) : value;
}
}
return when(all(files), function(files){
Expand Down

0 comments on commit 02cf745

Please sign in to comment.