{"name":"@koa/cors","version":"2.2.2","description":"Cross-Origin Resource Sharing(CORS) for koa","main":"index.js","files":["index.js"],"scripts":{"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 '^'"},"dependencies":{},"devDependencies":{"autod":"*","eslint":"^2.3.0","eslint-config-egg":"^2.0.0","istanbul":"*","koa":"^2.5.1","mocha":"3","supertest":"^3.1.0"},"homepage":"https://github.com/koajs/cors","repository":{"type":"git","url":"git://github.com/koajs/cors.git"},"bugs":{"url":"https://github.com/koajs/cors/issues"},"keywords":["cors","koa-cors","Cross-Origin Resource Sharing","@koa/cors","koa","koajs"],"engines":{"node":">= 6.0.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.com"},"license":"MIT","gitHead":"b5a937fc24666761c61b1ac633f49f54612d1315","_id":"@koa/cors@2.2.2","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"integrity":"sha512-Ollvsy3wB8+7R9w6hPVzlj3wekF6nK+IHpHj7faSPVXCkahqCwNEPp9+0C4b51RDkdpHjevLEGLOKuVjqtXgSQ==","shasum":"9084ab7f58107734e6b19d602d99538eda73f2d0","tarball":"http://registry-npm.ywwl.com/@koa/cors/download/@koa/cors-2.2.2.tgz","fileCount":5,"unpackedSize":9791,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbRfzfCRA9TVsSAnZWagAAODEP/3fksoP14/qm1Kb6dilK\npbtC+KNAaGYrx3f/6WR+bzutIZ7r+/XHxEEkLn2Uu964Db0B4MAEFfmc9ODl\nUVxE5IsEGNb2CdXXmZVyem9HYQkQITJrh5SQVlnFdDQZP6+cAdE4m1Gbl857\nNO97YOBtd9iq6UxQnqByfjdUYtfG4S/jj+nog4tFJh/7KiOjYhQ3/03lpxky\nI7VogOefpDI7f/nkDIIbp09hpamuOtNgLBt94eea2UfEt42GFRN8NDqY5PWB\ncuC8kt/ebL0Bgh5wV4koOiCl3gmTNc9a+pWaoCZM01NHudvN8LPdZzBHOkMs\nu7zqY0ftJ74MUUQ12ez9J+m6Cr5mDWVThS7TLZ0D2bch06b8vZkbOwIUgiEN\ndCcYDpj2iNhdAh75Il9nmJmFnVYavmt/CtU922D7J4z7aU5hM6+73dUMXq2D\nG/EBbfKxyXtcN8UUHVW2pH/CidUd/49d1SWFAJ0X/9C0mHEPvCAMsq4BoRIT\nuDasRKgmAIjb3EbIKSklTioaIfYDpRAocedCvhGIBt0GlZ06D//qsbBVKElF\nIor55RqPEYfbnjSWGU1Od+EbGjJahnS4MXuuAZcUsrIbyjGsQHk73uFOut2I\n78fRwVaATg9EAG5wtEXdW4FdLX6FRZIf6S/IqckSPlEmFKKQYH7joUQaljEd\nLToT\r\n=OEAZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBxXtleDdREHHd7dX8fjZ+B6OQDjcOwKzCr5ewwRk0FzAiEA8q2XBz1KeJh2koBObPtfq2AUF1xXpyorQnEjl7n14x8="}],"size":3674,"noattachment":false,"key":"/@koa/cors/-/@koa/cors-2.2.2.tgz"},"maintainers":[{"email":"aaron.heckmann+github@gmail.com","name":"aaron"},{"email":"haoxins@outlook.com","name":"coderhaoxin"},{"email":"dead_horse@qq.com","name":"dead_horse"},{"email":"dead_horse@qq.com","name":"dead-horse"},{"email":"eivind.fjeldstad@gmail.com","name":"eivifj"},{"email":"fengmk2@gmail.com","name":"fengmk2"},{"email":"jonathanrichardong@gmail.com","name":"jongleberry"},{"email":"julian@juliangruber.com","name":"juliangruber"},{"email":"tj@vision-media.ca","name":"tjholowaychuk"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cors_2.2.2_1531313375625_0.6766918754651792"},"_hasShrinkwrap":false,"readme":"# @koa/cors\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/koajs/cors/actions/workflows/nodejs.yml/badge.svg)](https://github.com/koajs/cors/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/@koa/cors.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@koa/cors\n[codecov-image]: https://codecov.io/github/koajs/cors/coverage.svg?branch=v2.x\n[codecov-url]: https://codecov.io/github/koajs/cors?branch=v2.x\n[download-image]: https://img.shields.io/npm/dm/@koa/cors.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@koa/cors\n\n[Cross-Origin Resource Sharing(CORS)](https://developer.mozilla.org/en/docs/Web/HTTP/Access_control_CORS) for koa\n\n## Installation\n\n```bash\n$ npm install @koa/cors --save\n```\n\n## Quick start\n\nEnable cors with default options:\n\n- origin: request Origin header\n- allowMethods: GET,HEAD,PUT,POST,DELETE,PATCH\n\n```js\nconst Koa = require('koa');\nconst cors = require('@koa/cors');\n\nconst app = new Koa();\napp.use(cors());\n```\n\n## cors(options)\n\n```js\n/**\n * CORS middleware\n *\n * @param {Object} [options]\n *  - {String|Function(ctx)} origin `Access-Control-Allow-Origin`, default is '*'\n *    If `credentials` set and return `true, the `origin` default value will set to the request `Origin` header\n *  - {String|Array} allowMethods `Access-Control-Allow-Methods`, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'\n *  - {String|Array} exposeHeaders `Access-Control-Expose-Headers`\n *  - {String|Array} allowHeaders `Access-Control-Allow-Headers`\n *  - {String|Number} maxAge `Access-Control-Max-Age` in seconds\n *  - {Boolean|Function(ctx)} credentials `Access-Control-Allow-Credentials`, default is false.\n *  - {Boolean} keepHeadersOnError Add set headers to `err.header` if an error is thrown\n *  - {Boolean} secureContext `Cross-Origin-Opener-Policy` & `Cross-Origin-Embedder-Policy` headers.', default is false\n *  - {Boolean} privateNetworkAccess handle `Access-Control-Request-Private-Network` request by return `Access-Control-Allow-Private-Network`, default to false\n * @return {Function} cors middleware\n * @api public\n */\n```\n\n## Breaking change between 5.0 and 4.0\n\nThe default `origin` is set to `*`, if you want to keep the 4.0 behavior, you can set the `origin` handler like this:\n\n```js\napp.use(cors({\n  origin(ctx) {\n    return ctx.get('Origin') || '*';\n  },\n}));\n```\n\n## License\n\n[MIT](./LICENSE)\n\n<!-- GITCONTRIBUTOR_START -->\n\n## Contributors\n\n|[<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/55783048?v=4\" width=\"100px;\"/><br/><sub><b>cma-skedulo</b></sub>](https://github.com/cma-skedulo)<br/>|\n| :---: | :---: | :---: | :---: | :---: | :---: |\n|[<img src=\"https://avatars.githubusercontent.com/u/6992588?v=4\" width=\"100px;\"/><br/><sub><b>CleberRossi</b></sub>](https://github.com/CleberRossi)<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/1217939?v=4\" width=\"100px;\"/><br/><sub><b>j-waaang</b></sub>](https://github.com/j-waaang)<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/>|\n[<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/14932834?v=4\" width=\"100px;\"/><br/><sub><b>swain</b></sub>](https://github.com/swain)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/49938086?v=4\" width=\"100px;\"/><br/><sub><b>TyrealHu</b></sub>](https://github.com/TyrealHu)<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/>\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Oct 08 2022 21:35:10 GMT+0800`.\n\n<!-- GITCONTRIBUTOR_END -->\n","publish_time":1531313375683,"_cnpm_publish_time":1531313375683,"dist-tags":{"latest":"5.0.0","latest-3":"3.4.3"}}