1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

1-1329: return 400 when pattern is empty but example is not (#4609)

Adding an example when there is no pattern doesn't make any sense, so it
should be an error.

Tests in https://github.com/ivarconr/unleash-enterprise/pull/721
This commit is contained in:
Thomas Heartman 2023-09-05 11:09:55 +02:00 committed by GitHub
parent 848b35a7a6
commit 8a8a7b0899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,6 +180,12 @@ export default class ProjectService {
`You've provided a feature flag naming example ("${example}") that doesn't match your feature flag naming pattern ("${pattern}"). Please provide an example that matches your supplied pattern.`, `You've provided a feature flag naming example ("${example}") that doesn't match your feature flag naming pattern ("${pattern}"). Please provide an example that matches your supplied pattern.`,
); );
} }
if (!pattern && example) {
throw new BadDataError(
"You've provided a feature flag naming example, but no feature flag naming pattern. You must specify a pattern to use an example.",
);
}
} }
}; };