Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appa

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appa - npm Package Compare versions

Comparing version 6.1.2 to 6.1.3

6

CHANGELOG.md

@@ -11,2 +11,8 @@ # appa change log

## 6.1.3 - 2017-07-02
## Fixed
- make it possible to skip body parsing with `{ parse: false }` option
## 6.1.2 - 2017-02-25

@@ -13,0 +19,0 @@

33

index.js

@@ -73,3 +73,3 @@ var assert = require('assert')

* @param {Object} options – options for the request handler
* @param {Boolean} options.parseJSON – optionally disable JSON parsing of the body. Default: `true`
* @param {Boolean} options.parse – optionally disable parsing of the body. Default: `true`
* @param {Function} callback – the route handler

@@ -91,3 +91,3 @@ * @example

options.parseJSON = options.parseJSON === false ? options.parseJSON : true
options.parse = options.parse === false ? options.parse : true

@@ -98,15 +98,7 @@ return router.on(pathname, function (params, req, res, ctx) {

function respond (req, res, ctx) {
try {
return callback(req, res, ctx)
} catch (e) {
return error(500, 'Internal server error', e).pipe(res)
}
}
if (req.method === 'POST' || req.method === 'PUT' || req.method === 'PATCH') {
function parse (req, options) {
body(req, options, function (err, result) {
if (err) return error(err.status, err.type).pipe(res)
if (isType(req, ['json']) && options.parseJSON) {
if (isType(req, ['json'])) {
ctx.body = parseJSON(res, result)

@@ -119,5 +111,18 @@ } else {

})
} else {
return respond(req, res, ctx)
}
function respond (req, res, ctx) {
try {
return callback(req, res, ctx)
} catch (e) {
return error(500, 'Internal server error', e).pipe(res)
}
}
if (req.method === 'POST' || req.method === 'PUT' || req.method === 'PATCH') {
if (options.parse === false) return respond(req, res, ctx)
return parse(req, options)
}
return respond(req, res, ctx)
})

@@ -124,0 +129,0 @@ }

{
"name": "appa",
"version": "6.1.2",
"version": "6.1.3",
"description": "Quickly create simple JSON API services.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc