openrosa-form-submission-middleware
Advanced tools
Comparing version 1.0.1 to 1.0.2
11
index.js
@@ -16,2 +16,3 @@ /*! | ||
var typeis = require('type-is'); | ||
var debug = require('debug')('openrosa-form-submission'); | ||
var fs = require('fs'); | ||
@@ -50,4 +51,6 @@ var openrosaRequest = require('openrosa-request-middleware'); | ||
// ignore GET | ||
if ('GET' === req.method || 'HEAD' === req.method) return next(); | ||
// Response to HEAD requests with status 204 | ||
if ('HEAD' === req.method) return res.sendStatus(204); | ||
// Ignore all other request methods other than post | ||
else if ('POST' !== req.method) return next(); | ||
@@ -75,3 +78,5 @@ // check Content-Type | ||
req.body = data.toString(); | ||
fs.unlink(val.path, function() {}); | ||
fs.unlink(val.path, function(err) { | ||
if (err) debug('Error deleting file %s', file.path); | ||
}); | ||
processingXml = false; | ||
@@ -78,0 +83,0 @@ if (done && !wasError) next(); |
{ | ||
"name": "openrosa-form-submission-middleware", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Express middleware for receiving OpenRosa xform submissions", | ||
@@ -29,2 +29,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"debug": "^2.1.1", | ||
"multiparty": "~4.0.0", | ||
@@ -36,3 +37,3 @@ "on-finished": "~2.1.0", | ||
"devDependencies": { | ||
"connect": "3", | ||
"express": "^4.0.0", | ||
"mocha": "~1.21.3", | ||
@@ -39,0 +40,0 @@ "should": "~4.0.4", |
@@ -7,3 +7,3 @@ # OpenRosa FormSubmissionAPI middleware | ||
It is [connect](https://github.com/senchalabs/connect/) middleware for [multiparty](https://github.com/andrewrk/node-multiparty/) to process OpenRosa form submissions from [ODK Collect](https://opendatakit.org/use/collect/) following the [OpenRosa FormSubmissionAPI spec](https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI). | ||
It is [express](http://expressjs.com/) middleware for [multiparty](https://github.com/andrewrk/node-multiparty/) to process OpenRosa form submissions from [ODK Collect](https://opendatakit.org/use/collect/) following the [OpenRosa FormSubmissionAPI spec](https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI). | ||
@@ -10,0 +10,0 @@ The xml form submission is returned as req.body and any attached files are returned as req.files. |
5854
111
5
+ Addeddebug@^2.1.1
+ Addeddebug@2.6.9(transitive)
+ Addedms@2.0.0(transitive)