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

koa

Package Overview
Dependencies
Maintainers
5
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 2.6.2 to 2.7.0

21

History.md
2.7.0 / 2019-01-28
==================
**features**
* [[`b7bfa71`](http://github.com/koajs/koa/commit/b7bfa7113b8d1af49a57ab767f24a599ed92044f)] - feat: change set status assert, allowing valid custom statuses (#1308) (Martin Iwanowski <<martin@iwanowski.se>>)
**others**
* [[`72f325b`](http://github.com/koajs/koa/commit/72f325b78edd0dc2aac940a76ce5f644005ce4c3)] - chore: add pr welcoming badge (#1291) (James George <<jamesgeorge998001@gmail.com>>)
* [[`b15115b`](http://github.com/koajs/koa/commit/b15115b2cbfffe15827cd5e4368267d417b72f08)] - chore: Reduce unnecessary variable declarations (#1298) (call me saisai <<1457358080@qq.com>>)
* [[`ad91ce2`](http://github.com/koajs/koa/commit/ad91ce2346cb34e5d5a49d07dd952d15f6c832a3)] - chore: license 2019 (dead-horse <<dead_horse@qq.com>>)
* [[`b25e79d`](http://github.com/koajs/koa/commit/b25e79dfb599777a38157bd419395bd28369ee86)] - Mark two examples as live for the corresponding documentation change in https://github.com/koajs/koajs.com/pull/38. (#1031) (Francisco Ryan Tolmasky I <<tolmasky@gmail.com>>)
* [[`d9ef603`](http://github.com/koajs/koa/commit/d9ef60398e88f2c2f958ab2b159d38052ffe7f8a)] - chore: Optimize array split (#1295) (Mikhail Bodrov <<connormiha1@gmail.com>>)
* [[`9be8583`](http://github.com/koajs/koa/commit/9be858312553002841725b617050aaff3c48951d)] - chore: replace ~~ with Math.trunc in res.length (option) (#1288) (jeremiG <<gendronjeremi@gmail.com>>)
* [[`7e46c20`](http://github.com/koajs/koa/commit/7e46c2058cb5994809eab5f4dbb12f21e937c72b)] - docs: add link to the license file (#1290) (James George <<jamesgeorge998001@gmail.com>>)
* [[`48993ad`](http://github.com/koajs/koa/commit/48993ade9b0831fbce28d94b3b0963a4b0dccbdd)] - docs: Document other body types (#1285) (Douglas Wade <<douglas.b.wade@gmail.com>>)
* [[`acb388b`](http://github.com/koajs/koa/commit/acb388bc0546b48fca11dce8aa7a595af2cda5e2)] - docs: Add security vulnerability disclosure instructions to the Readme (#1283) (Douglas Wade <<douglas.b.wade@gmail.com>>)
* [[`a007198`](http://github.com/koajs/koa/commit/a007198fa23c19902b1f3ffb81498629e0e9c875)] - docs: Document ctx.app.emit (#1284) (Douglas Wade <<douglas.b.wade@gmail.com>>)
* [[`f90e825`](http://github.com/koajs/koa/commit/f90e825da9d505c11b4262c50cd54553f979c300)] - docs: response.set(fields) won't overwrites previous header fields(#1282) (Douglas Wade <<douglas.b.wade@gmail.com>>)
* [[`fc93c05`](http://github.com/koajs/koa/commit/fc93c05f68398f30abc46fd16ae6c673a1eee099)] - docs: update readme to add babel 7 instructions (#1274) (Vikram Rangaraj <<vik120@icloud.com>>)
* [[`5560f72`](http://github.com/koajs/koa/commit/5560f729124f022ffed00085aafea43dded7fb03)] - chore: use the ability of `content-type` lib directly (#1276) (Jordan <<mingmingwon@gmail.com>>)
2.6.2 / 2018-11-10

@@ -3,0 +24,0 @@ ==================

2

lib/application.js

@@ -203,5 +203,5 @@

const res = ctx.res;
if (!ctx.writable) return;
const res = ctx.res;
let body = ctx.body;

@@ -208,0 +208,0 @@ const code = ctx.status;

@@ -260,3 +260,3 @@

if (!host) return '';
return host.split(/\s*,\s*/)[0];
return host.split(/\s*,\s*/, 1)[0];
},

@@ -277,3 +277,3 @@

if ('[' == host[0]) return this.URL.hostname || ''; // IPv6
return host.split(':')[0];
return host.split(':', 1)[0];
},

@@ -372,12 +372,8 @@

get charset() {
let type = this.get('Content-Type');
if (!type) return '';
try {
type = contentType.parse(type);
const { parameters } = contentType.parse(this.req);
return parameters.charset || '';
} catch (e) {
return '';
}
return type.parameters.charset || '';
},

@@ -414,3 +410,3 @@

const proto = this.get('X-Forwarded-Proto');
return proto ? proto.split(/\s*,\s*/)[0] : 'http';
return proto ? proto.split(/\s*,\s*/, 1)[0] : 'http';
},

@@ -417,0 +413,0 @@

@@ -86,4 +86,4 @@

assert('number' == typeof code, 'status code must be a number');
assert(statuses[code], `invalid status code: ${code}`);
assert(Number.isInteger(code), 'status code must be a number');
assert(code >= 100 && code <= 999, `invalid status code: ${code}`);
this._explicitStatus = true;

@@ -215,3 +215,3 @@ this.res.statusCode = code;

return ~~len;
return Math.trunc(len) || 0;
},

@@ -386,3 +386,3 @@

if (!type) return '';
return type.split(';')[0];
return type.split(';', 1)[0];
},

@@ -389,0 +389,0 @@

{
"name": "koa",
"version": "2.6.2",
"version": "2.7.0",
"description": "Koa web app framework",

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

@@ -9,2 +9,3 @@ <img src="/docs/logo.png" alt="Koa middleware framework for nodejs"/>

[![OpenCollective Sponsors][sponsors-image]](#sponsors)
[![PR's Welcome][pr-welcoming-image]][pr-welcoming-url]

@@ -165,14 +166,20 @@ Expressive HTTP middleware framework for node.js to make web applications and APIs more enjoyable to write. Koa's middleware stack flows in a stack-like manner, allowing you to perform actions downstream then filter and manipulate the response upstream.

If you're not using `node v7.6+`, we recommend setting up `babel` with [`babel-preset-env`](https://github.com/babel/babel-preset-env):
If you're not using `node v7.6+`, we recommend setting up `babel` with [`@babel/preset-env`](https://babeljs.io/docs/en/next/babel-preset-env):
```bash
$ npm install babel-register babel-preset-env --save
$ npm install @babel/register @babel/preset-env @babel/cli --save-dev
```
Setup `babel-register` in your entry file:
In development, you'll want to use [`@babel/register`](https://babeljs.io/docs/en/next/babel-register):
```js
require('babel-register');
```bash
node --require @babel/register <your-entry-file>
```
In production, you'll want to build your files with [`@babel/cli`](https://babeljs.io/docs/en/babel-cli). Suppose you are compiling a folder `src` and you wanted the output to go to a new folder `dist` with non-javascript files copied:
```bash
babel src --out-dir dist --copy-files
```
And have your `.babelrc` setup:

@@ -183,3 +190,3 @@

"presets": [
["env", {
["@babel/preset-env", {
"targets": {

@@ -204,2 +211,8 @@ "node": true

## Reporting vulnerabilities
To report a security vulnerability, please do not open an issue, as this notifies attackers
of the vulnerability. Instead, please email [dead_horse](mailto:heyiyu.deadhorse@gmail.com) and [jonathanong](mailto:me@jongleberry.com) to
disclose.
## Authors

@@ -303,3 +316,3 @@

MIT
[MIT](https://github.com/koajs/koa/blob/master/LICENSE)

@@ -317,1 +330,3 @@ [npm-image]: https://img.shields.io/npm/v/koa.svg?style=flat-square

[#koajs]: https://webchat.freenode.net/?channels=#koajs
[pr-welcoming-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[pr-welcoming-url]: https://github.com/koajs/koa

Sorry, the diff of this file is not supported yet

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