Comparing version 3.1.0 to 3.2.0
3.2.0 / 2022-03-12 | ||
================== | ||
**features** | ||
* [[`134ec9b`](http://github.com/koajs/cors/commit/134ec9b54b18565cf8bba8c5e6b6639d7d7e43a3)] - feat: support secure context headers (Levi Tomes <<levi@userdevice.net>>) | ||
**others** | ||
* [[`bcadb55`](http://github.com/koajs/cors/commit/bcadb5599905c28934ed3c28f866f6cdb3f77aee)] - test: run test on github action (fengmk2 <<fengmk2@gmail.com>>) | ||
3.1.0 / 2020-05-17 | ||
@@ -3,0 +12,0 @@ ================== |
15
index.js
@@ -16,4 +16,6 @@ 'use strict'; | ||
* - {Boolean} keepHeadersOnError Add set headers to `err.header` if an error is thrown | ||
* - {Boolean} secureContext `Cross-Origin-Opener-Policy` & `Cross-Origin-Embedder-Policy` headers.', default is false | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/Planned_changes | ||
* @return {Function} cors middleware | ||
* @api public | ||
* @public | ||
*/ | ||
@@ -23,2 +25,3 @@ module.exports = function(options) { | ||
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH', | ||
secureContext: false, | ||
}; | ||
@@ -96,2 +99,7 @@ | ||
if (options.secureContext) { | ||
set('Cross-Origin-Opener-Policy', 'same-origin'); | ||
set('Cross-Origin-Embedder-Policy', 'require-corp'); | ||
} | ||
if (!options.keepHeadersOnError) { | ||
@@ -139,2 +147,7 @@ return await next(); | ||
if (options.secureContext) { | ||
set('Cross-Origin-Opener-Policy', 'same-origin'); | ||
set('Cross-Origin-Embedder-Policy', 'require-corp'); | ||
} | ||
let allowHeaders = options.allowHeaders; | ||
@@ -141,0 +154,0 @@ if (!allowHeaders) { |
{ | ||
"name": "@koa/cors", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Cross-Origin Resource Sharing(CORS) for koa", | ||
@@ -10,7 +10,7 @@ "main": "index.js", | ||
"scripts": { | ||
"contributor": "git-contributor", | ||
"test": "NODE_ENV=test mocha --check-leaks -R spec -t 5000 test/*.test.js", | ||
"test-cov": "NODE_ENV=test istanbul cover _mocha -- --check-leaks -t 5000 test/*.test.js", | ||
"ci": "npm run lint && npm run test-cov", | ||
"lint": "eslint index.js test", | ||
"autod": "autod -w --prefix '^'" | ||
"lint": "eslint index.js test" | ||
}, | ||
@@ -21,5 +21,6 @@ "dependencies": { | ||
"devDependencies": { | ||
"autod": "*", | ||
"egg-ci": "^1.19.0", | ||
"eslint": "^5.15.1", | ||
"eslint-config-egg": "^7.1.0", | ||
"git-contributor": "^1.0.10", | ||
"istanbul": "*", | ||
@@ -49,4 +50,11 @@ "koa": "^2.5.1", | ||
}, | ||
"author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.com)", | ||
"ci": { | ||
"version": "8, 10, 12, 14, 16", | ||
"type": "github", | ||
"os": { | ||
"github": "linux" | ||
} | ||
}, | ||
"author": "fengmk2 <fengmk2@gmail.com> (http://github.com/fengmk2)", | ||
"license": "MIT" | ||
} |
@@ -5,5 +5,4 @@ @koa/cors | ||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![Node.js CI](https://github.com/koajs/cors/actions/workflows/nodejs.yml/badge.svg)](https://github.com/koajs/cors/actions/workflows/nodejs.yml) | ||
[![Test coverage][codecov-image]][codecov-url] | ||
[![David deps][david-image]][david-url] | ||
[![npm download][download-image]][download-url] | ||
@@ -13,8 +12,4 @@ | ||
[npm-url]: https://npmjs.org/package/@koa/cors | ||
[travis-image]: https://img.shields.io/travis/koajs/cors.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/koajs/cors | ||
[codecov-image]: https://codecov.io/github/koajs/cors/coverage.svg?branch=v2.x | ||
[codecov-url]: https://codecov.io/github/koajs/cors?branch=v2.x | ||
[david-image]: https://img.shields.io/david/koajs/cors.svg?style=flat-square | ||
[david-url]: https://david-dm.org/koajs/cors | ||
[download-image]: https://img.shields.io/npm/dm/@koa/cors.svg?style=flat-square | ||
@@ -60,2 +55,3 @@ [download-url]: https://npmjs.org/package/@koa/cors | ||
* - {Boolean} keepHeadersOnError Add set headers to `err.header` if an error is thrown | ||
* - {Boolean} secureContext `Cross-Origin-Opener-Policy` & `Cross-Origin-Embedder-Policy` headers.', default is false | ||
* @return {Function} cors middleware | ||
@@ -69,1 +65,14 @@ * @api public | ||
[MIT](./LICENSE) | ||
<!-- GITCONTRIBUTOR_START --> | ||
## Contributors | ||
|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars.githubusercontent.com/u/1127384?v=4" width="100px;"/><br/><sub><b>omsmith</b></sub>](https://github.com/omsmith)<br/>|[<img src="https://avatars.githubusercontent.com/u/643505?v=4" width="100px;"/><br/><sub><b>jonathanong</b></sub>](https://github.com/jonathanong)<br/>|[<img src="https://avatars.githubusercontent.com/u/5622516?v=4" width="100px;"/><br/><sub><b>AlphaWong</b></sub>](https://github.com/AlphaWong)<br/>|[<img src="https://avatars.githubusercontent.com/u/178720?v=4" width="100px;"/><br/><sub><b>erikfried</b></sub>](https://github.com/erikfried)<br/>| | ||
| :---: | :---: | :---: | :---: | :---: | :---: | | ||
|[<img src="https://avatars.githubusercontent.com/u/4184677?v=4" width="100px;"/><br/><sub><b>ltomes</b></sub>](https://github.com/ltomes)<br/>|[<img src="https://avatars.githubusercontent.com/u/372420?v=4" width="100px;"/><br/><sub><b>lfreneda</b></sub>](https://github.com/lfreneda)<br/>|[<img src="https://avatars.githubusercontent.com/u/170299?v=4" width="100px;"/><br/><sub><b>matthewmueller</b></sub>](https://github.com/matthewmueller)<br/>|[<img src="https://avatars.githubusercontent.com/u/6006498?v=4" width="100px;"/><br/><sub><b>PlasmaPower</b></sub>](https://github.com/PlasmaPower)<br/>|[<img src="https://avatars.githubusercontent.com/u/8369011?v=4" width="100px;"/><br/><sub><b>xg-wang</b></sub>](https://github.com/xg-wang)<br/>|[<img src="https://avatars.githubusercontent.com/u/12003270?v=4" width="100px;"/><br/><sub><b>lishengzxc</b></sub>](https://github.com/lishengzxc)<br/>| | ||
[<img src="https://avatars.githubusercontent.com/u/514097?v=4" width="100px;"/><br/><sub><b>mcohen75</b></sub>](https://github.com/mcohen75)<br/> | ||
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Mar 12 2022 23:53:42 GMT+0800`. | ||
<!-- GITCONTRIBUTOR_END --> |
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
14800
131
75
8