openrosa-form-submission-middleware
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -0,3 +1,44 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## [Unreleased] | ||
## [1.1.0] | ||
### Fixed | ||
- Set location header on response to HEAD request fixes #1 | ||
### Added | ||
- Add option to redirect to https for secure submission | ||
## [1.0.4] | ||
### Changed | ||
- Switch to [JS Standard style](https://github.com/feross/standard) | ||
- Add debugging messages | ||
## [1.0.3] | ||
### Changed | ||
- Minor fixes to code style and error reporting | ||
## [1.0.2] | ||
### Fixed | ||
- Correctly respond to HEAD requests | ||
### Changed | ||
- Switch to Express for testing | ||
- Add debug messages | ||
## [1.0.1] | ||
### Fixed | ||
- Remove form from disk once processed | ||
### 1.0.0 | ||
Initial release | ||
[Unreleased]: https://github.com/digidem/openrosa-form-submission-middleware/compare/v1.1.0...HEAD | ||
[1.1.0]: https://github.com/digidem/openrosa-form-submission-middleware/compare/v1.0.4...v1.1.0 | ||
[1.0.4]: https://github.com/digidem/openrosa-form-submission-middleware/compare/v1.0.3...v1.0.4 | ||
[1.0.3]: https://github.com/digidem/openrosa-form-submission-middleware/compare/v1.0.2...v1.0.3 | ||
[1.0.2]: https://github.com/digidem/openrosa-form-submission-middleware/compare/v1.0.1...v1.0.2 | ||
[1.0.1]: https://github.com/digidem/openrosa-form-submission-middleware/compare/v1.0.0...v1.0.1 |
@@ -37,2 +37,4 @@ /*! | ||
* @param {Object} options | ||
* @param {number} [options.maxContentLength=10485760] Max content length for submissions (defaults to 10Mb) | ||
* @param {boolean} [options.secure=false] Redirect form submissions to https (defaults to false) | ||
* @return {Function} | ||
@@ -45,2 +47,3 @@ * @api public | ||
options.maxContentLength = options.maxContentLength || 10485760 | ||
options.secure = options.secure || false | ||
@@ -54,2 +57,5 @@ function multipart (req, res, next) { | ||
// Response to HEAD requests with status 204 | ||
var protocol = options.secure ? 'https' : req.protocol | ||
var locationUrl = protocol + '://' + req.headers.host + req.originalUrl | ||
res.setHeader('Location', locationUrl) | ||
return res.sendStatus(204) | ||
@@ -56,0 +62,0 @@ } else if (req.method !== 'POST') { |
{ | ||
"name": "openrosa-form-submission-middleware", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Express middleware for receiving OpenRosa xform submissions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,5 +5,5 @@ # OpenRosa FormSubmissionAPI middleware | ||
This is based on | ||
[connect-multiparty](https://github.com/andrewrk/connect-multiparty) by | ||
[Andrew Kelley](https://github.com/andrewrk/). | ||
This is based on | ||
[connect-multiparty](https://github.com/andrewrk/connect-multiparty) by | ||
[Andrew Kelley](https://github.com/andrewrk/). | ||
@@ -36,3 +36,12 @@ 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). | ||
If you pass options to `openrosa()`, they are passed directly into | ||
multiparty. | ||
## API | ||
### openrosa(options) | ||
Returns express middleware for receiving and processing OpenRosa form submissions. | ||
* `options.maxContentLength` sets the maximum content length of form submissions (defaults to 10Mb) | ||
* `options.secure` will redirect OpenRosa clients like ODK Collect to use https to send a submission (it does this by responding to the initial HEAD request from the client with a 204 with the Location headers set with the https protocol set) | ||
Other options are passed directly on to multiparty. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8444
125
46