feat: Allow multiple origins for header Access-Control-Allow-Origin (#8517)

This commit is contained in:
Marc Derhammer
2023-05-01 16:25:22 -04:00
committed by GitHub
parent 9e43bc2fa0
commit 4f15539ac2
6 changed files with 49 additions and 6 deletions

View File

@@ -161,6 +161,9 @@ function mapperFor(elt, t) {
if (type == 'NumberOrBoolean') {
return wrap(t.identifier('numberOrBooleanParser'));
}
if (type === 'StringOrStringArray') {
return wrap(t.identifier('arrayParser'));
}
return wrap(t.identifier('objectParser'));
}
}
@@ -278,6 +281,9 @@ function inject(t, list) {
const adapterType = elt.typeAnnotation.typeParameters.params[0].id.name;
type = `Adapter<${adapterType}>`;
}
if (type === 'StringOrStringArray') {
type = 'String|String[]';
}
comments += ` * @property {${type}} ${elt.name} ${elt.help}\n`;
const obj = t.objectExpression(props);
return t.objectProperty(t.stringLiteral(elt.name), obj);