function applyCorsHeaders(headers, options) {
  const {
    origin = "*",
    methods = ["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH", "OPTIONS"],
    allowedHeaders = ["Content-Type"],
    exposedHeaders,
    credentials,
    maxAge
  } = options;
  headers.append("Access-Control-Allow-Origin", origin);
  headers.append("Access-Control-Allow-Methods", methods.join(", ").toUpperCase());
  if (allowedHeaders)
    headers.append("Access-Control-Allow-Headers", allowedHeaders.join(", "));
  if (exposedHeaders)
    headers.append("Access-Control-Expose-Headers", exposedHeaders.join(", "));
  if (credentials)
    headers.append("Access-Control-Allow-Credentials", "true");
  if (maxAge != null)
    headers.append("Access-Control-Max-Age", `${maxAge}`);
}
export {
  applyCorsHeaders
};
//# sourceMappingURL=cors.js.map