mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
fixed the bug resultTtlInSeconds defaults to 300 when set to 0
This commit is contained in:
parent
b3a49d580c
commit
cf441a4dbc
@ -51,7 +51,8 @@ module.exports = {
|
||||
throw new this.serverless.classes
|
||||
.Error('Please provide either an authorizer name or ARN');
|
||||
}
|
||||
resultTtlInSeconds = Number.parseInt(authorizer.resultTtlInSeconds, 10) || 300;
|
||||
resultTtlInSeconds = Number.parseInt(authorizer.resultTtlInSeconds, 10);
|
||||
resultTtlInSeconds = Number.isNaN(resultTtlInSeconds) ? 300 : resultTtlInSeconds;
|
||||
identitySource = authorizer.identitySource || 'method.request.header.Authorization';
|
||||
} else {
|
||||
const errorMessage = [
|
||||
|
||||
@ -108,7 +108,7 @@ describe('#compileAuthorizers()', () => {
|
||||
it('should create authorizer with the given config object', () => {
|
||||
awsCompileApigEvents.serverless.service.functions.first.events[0].http.authorizer = {
|
||||
name: 'authorizer',
|
||||
resultTtlInSeconds: 400,
|
||||
resultTtlInSeconds: 0,
|
||||
identitySource: 'method.request.header.Custom',
|
||||
identityValidationExpression: 'regex',
|
||||
};
|
||||
@ -117,7 +117,7 @@ describe('#compileAuthorizers()', () => {
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.AuthorizerApiGatewayAuthorizer.Properties.AuthorizerResultTtlInSeconds
|
||||
).to.equal(400);
|
||||
).to.equal(0);
|
||||
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user