Skip to content

Commit

Permalink
upgrade @koa/cors to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Jan 8, 2024
1 parent 2466d60 commit 46c9173
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 36 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class Cors extends EventEmitter {
if (config.corsCredentials) corsOptions.credentials = config.corsCredentials
if (config.corsPrivateNetworkAccess) corsOptions.privateNetworkAccess = config.corsPrivateNetworkAccess

/* See https://github.com/koajs/cors/issues/94 */
corsOptions.origin = function origin (ctx) {
return ctx.get('origin') || '*'
}

this.emit('verbose', 'middleware.cors.config', {
...corsOptions,
openerPolicy: config.corsOpenerPolicy,
Expand Down
68 changes: 34 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"test": "test-runner test.js"
},
"dependencies": {
"@koa/cors": "^3.4.3"
"@koa/cors": "^5.0.0"
},
"devDependencies": {
"lws": "^4.1.2",
"node-fetch": "^3.3.0",
"node-fetch": "^3.3.2",
"test-runner": "^0.10.1"
},
"files": [
Expand Down

0 comments on commit 46c9173

Please sign in to comment.