@tinyhttp/cors
Advanced tools
Comparing version 0.2.3 to 0.2.4
# @tinyhttp/cors | ||
## 0.2.4 | ||
### Patch Changes | ||
- Fix Terser options | ||
## 0.2.3 | ||
@@ -4,0 +10,0 @@ |
@@ -1,1 +0,1 @@ | ||
import{vary as o}from"es-vary";const cors=({origin:e="*",o:s=["GET","HEAD","PUT","PATCH","POST","DELETE"],s:l,l:i,i:t,t:r,A:n=204})=>(c,A,f)=>{if("boolean"==typeof e&&!0===e)A.p("Access-Control-Allow-Origin","*");else if("string"==typeof e)A.p("Access-Control-Allow-Origin",e);else if("function"==typeof e)A.p("Access-Control-Allow-Origin",e(c,A));if("string"==typeof e&&"*"!==e||"function"==typeof e)o(A,"Origin");A.p("Access-Control-Allow-Methods",s.join(", ").toUpperCase());if(l)A.p("Access-Control-Allow-Headers",l);if(i)A.p("Access-Control-Expose-Headers",i);if(t)A.p("Access-Control-Allow-Credentials","true");if(r)A.p("Access-Control-Max-Age",r);if(void 0===f){A.C=n;A.end()}null==f||f()};export{cors}; | ||
import{vary as e}from"es-vary";const cors=({origin:o="*",methods:s=["GET","HEAD","PUT","PATCH","POST","DELETE"],allowedHeaders:t,exposedHeaders:r,credentials:l,maxAge:n,optionsSuccessStatus:a=204})=>(c,d,i)=>{"boolean"==typeof o&&!0===o?d.setHeader("Access-Control-Allow-Origin","*"):"string"==typeof o?d.setHeader("Access-Control-Allow-Origin",o):"function"==typeof o&&d.setHeader("Access-Control-Allow-Origin",o(c,d)),("string"==typeof o&&"*"!==o||"function"==typeof o)&&e(d,"Origin"),d.setHeader("Access-Control-Allow-Methods",s.join(", ").toUpperCase()),t&&d.setHeader("Access-Control-Allow-Headers",t),r&&d.setHeader("Access-Control-Expose-Headers",r),l&&d.setHeader("Access-Control-Allow-Credentials","true"),n&&d.setHeader("Access-Control-Max-Age",n),void 0===i&&(d.statusCode=a,d.end()),null==i||i()};export{cors}; |
{ | ||
"name": "@tinyhttp/cors", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "tinyhttp CORS module", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
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
8774
72