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

koa

Package Overview
Dependencies
Maintainers
9
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa - npm Package Compare versions

Comparing version 1.2.5 to 1.3.0

6

History.md
1.3.0 / 2017-03-07
==================
* added: node v7.7+ `res.getHeaderNames()` support #913
* added: `err.headerSent` in error handling #923
1.2.5 / 2017-02-12

@@ -3,0 +9,0 @@ ==================

20

lib/context.js

@@ -76,6 +76,4 @@

* this.throw(403)
* this.throw('name required', 400)
* this.throw(400, 'name required')
* this.throw('something exploded')
* this.throw(new Error('invalid'), 400);
* this.throw(400, new Error('invalid'));

@@ -110,2 +108,7 @@ *

var headerSent = false;
if (this.headerSent || !this.writable) {
headerSent = err.headerSent = true;
}
// delegate

@@ -117,9 +120,14 @@ this.app.emit('error', err, this);

// handler and log.
if (this.headerSent || !this.writable) {
err.headerSent = true;
if (headerSent) {
return;
}
// unset all headers, and set those specified
this.res._headers = {};
// first unset all headers
if (this.res.getHeaderNames) {
this.res.getHeaderNames().forEach(function(name) { this.removeHeader(name) }, this.res);
} else {
this.res._headers = {}; // Node < 8
}
// then set those specified
this.set(err.headers);

@@ -126,0 +134,0 @@

@@ -47,3 +47,5 @@

get header() {
return this.res._headers || {};
return this.res.getHeaders
? this.res.getHeaders()
: this.res._headers || {}; // Node < 8
},

@@ -50,0 +52,0 @@

{
"name": "koa",
"version": "1.2.5",
"version": "1.3.0",
"description": "Koa web app framework",

@@ -5,0 +5,0 @@ "main": "lib/application.js",

@@ -31,3 +31,3 @@ <img src="https://dl.dropboxusercontent.com/u/6396913/koa/logo.png" alt="koa middleware framework for nodejs" width="255px" />

```bash
npm install koa@2
npm install koa@next
```

@@ -122,3 +122,3 @@

Support us with a monthly donation and help us continue our activities.
Support us with a monthly donation and help us continue our activities.

@@ -159,3 +159,3 @@ <a href="https://opencollective.com/koajs/backer/0/website" target="_blank"><img src="https://opencollective.com/koajs/backer/0/avatar.svg"></a>

Become a sponsor and get your logo on our README on Github with a link to your site.
Become a sponsor and get your logo on our README on Github with a link to your site.

@@ -199,6 +199,6 @@ <a href="https://opencollective.com/koajs/sponsor/0/website" target="_blank"><img src="https://opencollective.com/koajs/sponsor/0/avatar.svg"></a>

[npm-url]: https://www.npmjs.com/package/koa
[travis-image]: https://img.shields.io/travis/koajs/koa/master.svg?style=flat-square
[travis-image]: https://img.shields.io/travis/koajs/koa/v1.x.svg?style=flat-square
[travis-url]: https://travis-ci.org/koajs/koa
[coveralls-image]: https://img.shields.io/codecov/c/github/koajs/koa.svg?style=flat-square
[coveralls-url]: https://codecov.io/github/koajs/koa?branch=master
[coveralls-url]: https://codecov.io/github/koajs/koa?branch=v1.x
[backers-image]: https://opencollective.com/koajs/backers/badge.svg?style=flat-square

@@ -205,0 +205,0 @@ [sponsors-image]: https://opencollective.com/koajs/sponsors/badge.svg?style=flat-square

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