mjackson / strata

A modular, streaming HTTP server for node.js
http://stratajs.org
366 stars 35 forks source link

allow multipart upload of empty file #41

Closed jeffbski closed 11 years ago

jeffbski commented 11 years ago

uploading an empty file caused an exception in the multipart/file because writeStream was not previously created.

I added a failing test and then the fix which creates the stream in the constructor.

 1) multipart Parser for an empty text file upload "before each" hook:
     TypeError: Cannot call method 'end' of undefined
      at File.end (/Users/barczewskij/projects/strata/lib/multipart/file.js:48:21)
      at Part.Parser.onPart.content (/Users/barczewskij/projects/strata/lib/multipart/parser.js:380:12)
      at Part.EventEmitter.emit (events.js:93:17)
      at Part.end (/Users/barczewskij/projects/strata/lib/multipart/part.js:69:8)