@elysiajs/cors
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -103,11 +103,12 @@ "use strict"; | ||
app.headers(defaultHeaders); | ||
function handleOption({ set, request }) { | ||
function handleOption({ set, request, headers }) { | ||
handleOrigin(set, request); | ||
handleMethod(set, request.headers.get('access-control-request-method')); | ||
if (allowedHeaders === true || exposeHeaders === true) { | ||
const headers = processHeaders(request.headers); | ||
if (allowedHeaders === true) | ||
set.headers['access-control-allow-headers'] = headers; | ||
set.headers['access-control-allow-headers'] = | ||
headers['access-control-request-headers']; | ||
if (exposeHeaders === true) | ||
set.headers['access-control-expose-headers'] = headers; | ||
set.headers['access-control-expose-headers'] = | ||
Object.keys(headers).join(','); | ||
} | ||
@@ -114,0 +115,0 @@ if (maxAge) |
@@ -100,11 +100,12 @@ import { Elysia } from 'elysia'; | ||
app.headers(defaultHeaders); | ||
function handleOption({ set, request }) { | ||
function handleOption({ set, request, headers }) { | ||
handleOrigin(set, request); | ||
handleMethod(set, request.headers.get('access-control-request-method')); | ||
if (allowedHeaders === true || exposeHeaders === true) { | ||
const headers = processHeaders(request.headers); | ||
if (allowedHeaders === true) | ||
set.headers['access-control-allow-headers'] = headers; | ||
set.headers['access-control-allow-headers'] = | ||
headers['access-control-request-headers']; | ||
if (exposeHeaders === true) | ||
set.headers['access-control-expose-headers'] = headers; | ||
set.headers['access-control-expose-headers'] = | ||
Object.keys(headers).join(','); | ||
} | ||
@@ -111,0 +112,0 @@ if (maxAge) |
{ | ||
"name": "@elysiajs/cors", | ||
"version": "1.0.4", | ||
"description": "Plugin for Elysia that for Cross Origin Requests (CORs)", | ||
"author": { | ||
"name": "saltyAom", | ||
"url": "https://github.com/SaltyAom", | ||
"email": "saltyaom@gmail.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/elysiajs/elysia-cors" | ||
}, | ||
"exports": { | ||
"bun": "./dist/index.js", | ||
"node": "./dist/cjs/index.js", | ||
"require": "./dist/cjs/index.js", | ||
"import": "./dist/index.js", | ||
"default": "./dist/cjs/index.js" | ||
}, | ||
"types": "./src/index.ts", | ||
"homepage": "https://github.com/elysiajs/elysia-cors", | ||
"keywords": [ | ||
"elysia", | ||
"cors" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "bun run --watch example/index.ts", | ||
"test": "bun test && npm run test:node", | ||
"test:node": "npm install --prefix ./test/node/cjs/ && npm install --prefix ./test/node/esm/ && node ./test/node/cjs/index.js && node ./test/node/esm/index.js", | ||
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", | ||
"release": "npm run build && npm run test && npm publish --access public" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "^1.0.4", | ||
"@types/node": "^18.11.7", | ||
"elysia": "1.0.28", | ||
"eslint": "^8.26.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^5.4.3" | ||
}, | ||
"peerDependencies": { | ||
"elysia": ">= 1.0.2" | ||
} | ||
"name": "@elysiajs/cors", | ||
"version": "1.0.5", | ||
"description": "Plugin for Elysia that for Cross Origin Requests (CORs)", | ||
"author": { | ||
"name": "saltyAom", | ||
"url": "https://github.com/SaltyAom", | ||
"email": "saltyaom@gmail.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/elysiajs/elysia-cors" | ||
}, | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
"bun": "./dist/index.js", | ||
"node": "./dist/cjs/index.js", | ||
"require": "./dist/cjs/index.js", | ||
"import": "./dist/index.js", | ||
"default": "./dist/cjs/index.js", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"homepage": "https://github.com/elysiajs/elysia-cors", | ||
"keywords": [ | ||
"elysia", | ||
"cors" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "bun run --watch example/index.ts", | ||
"test": "bun test && npm run test:node", | ||
"test:node": "npm install --prefix ./test/node/cjs/ && npm install --prefix ./test/node/esm/ && node ./test/node/cjs/index.js && node ./test/node/esm/index.js", | ||
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", | ||
"release": "npm run build && npm run test && npm publish --access public" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "^1.0.4", | ||
"@types/node": "^18.11.7", | ||
"elysia": "1.0.27", | ||
"eslint": "^8.26.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^5.4.3" | ||
}, | ||
"peerDependencies": { | ||
"elysia": ">= 1.0.2" | ||
} | ||
} |
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
30349
9
469