Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Release 0.1.0

  • Loading branch information...
commit ac57d4a612e06033fae420cf20d889274a85ec97 1 parent 8a1f77c
@tj tj authored
Showing with 16 additions and 9 deletions.
  1. +6 −0 History.md
  2. +9 −8 index.html
  3. +1 −1  package.json
View
6 History.md
@@ -0,0 +1,6 @@
+
+0.1.0 / 2010-07-14
+==================
+
+ * Changed api:
+ - use `form.complete(function(){})` instead of `form.onComplete = function(){}`
View
17 index.html
@@ -168,13 +168,13 @@
// Do something when parsing is finished
// and respond, or respond immediately
// and work with the files.
- req.form.onComplete = function(err, fields, files){
+ req.form.complete(function(err, fields, files){
res.writeHead(200, {});
if (err) res.write(JSON.stringify(err.message));
res.write(JSON.stringify(fields));
res.write(JSON.stringify(files));
res.end();
- };
+ });
// Regular request, pass to next middleware
} else {
next();
@@ -197,14 +197,15 @@
<span class="variable">options</span> = <span class="variable">options</span> || {};
<span class="keyword">return</span> <span class="keyword">function</span>(<span class="variable">req</span>, <span class="variable">res</span>, <span class="variable">next</span>){
<span class="keyword">if</span> (<span class="variable">formRequest</span>(<span class="variable">req</span>)) {
- <span class="keyword">var</span> <span class="variable">form</span> = <span class="variable">req</span>.<span class="variable">form</span> = <span class="keyword">new</span> <span class="variable">formidable</span>.<span class="class">IncomingForm</span>;
+ <span class="keyword">var</span> <span class="variable">callback</span> = <span class="keyword">function</span>(){},
+ <span class="variable">form</span> = <span class="variable">req</span>.<span class="variable">form</span> = <span class="keyword">new</span> <span class="variable">formidable</span>.<span class="class">IncomingForm</span>;
<span class="variable">utils</span>.<span class="variable">merge</span>(<span class="variable">form</span>, <span class="variable">options</span>);
- <span class="variable">form</span>.<span class="variable">onComplete</span> = <span class="keyword">function</span>(){};
- <span class="variable">next</span>();
- <span class="variable">form</span>.<span class="variable">parse</span>(<span class="variable">req</span>, <span class="variable">form</span>.<span class="variable">onComplete</span>);
- } <span class="keyword">else</span> {
- <span class="variable">next</span>();
+ <span class="variable">form</span>.<span class="variable">complete</span> = <span class="keyword">function</span>(<span class="variable">fn</span>){ <span class="variable">callback</span> = <span class="variable">fn</span>; };
+ <span class="variable">form</span>.<span class="variable">parse</span>(<span class="variable">req</span>, <span class="keyword">function</span>(){
+ <span class="variable">callback</span>.<span class="variable">apply</span>(<span class="this">this</span>, <span class="variable">arguments</span>);
+ });
}
+ <span class="variable">next</span>();
};
};</code></pre>
</td>
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "connect-form",
"description": "urlencoded / multipart form parsing middleware for Connect",
- "version": "0.0.1",
+ "version": "0.1.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"dependencies": { "formidable": ">= 0.9.3" },
"main": "./index",
Please sign in to comment.
Something went wrong with that request. Please try again.