mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
test(AWS API Gateway): Fix default override test
This commit is contained in:
parent
a3ebc01f2b
commit
fa6d72bb63
@ -1342,37 +1342,6 @@ describe('#compileMethods()', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should delete the default "application/x-www-form-urlencoded" template if it\'s overriden with null', () => {
|
||||
awsCompileApigEvents.validated.events = [
|
||||
{
|
||||
functionName: 'Second',
|
||||
http: {
|
||||
method: 'get',
|
||||
path: 'users/list',
|
||||
integration: 'AWS',
|
||||
request: {
|
||||
template: {
|
||||
'application/x-www-form-urlencoded': null,
|
||||
},
|
||||
},
|
||||
response: {
|
||||
statusCodes: {
|
||||
200: {
|
||||
pattern: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
return awsCompileApigEvents.compileMethods().then(() => {
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources
|
||||
.ApiGatewayMethodUsersListGet.Properties.Integration.RequestTemplates
|
||||
).to.not.have.key('application/x-www-form-urlencoded');
|
||||
});
|
||||
});
|
||||
|
||||
it('should use defined pass-through behavior', () => {
|
||||
awsCompileApigEvents.validated.events = [
|
||||
{
|
||||
@ -1930,3 +1899,36 @@ describe('#compileMethods()', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#compileMethods v2()', () => {
|
||||
describe('request configuration', () => {
|
||||
it('should delete the default "application/x-www-form-urlencoded" template if it\'s overriden with null', async () => {
|
||||
const {
|
||||
awsNaming,
|
||||
cfTemplate: { Resources: cfResources },
|
||||
} = await runServerless({
|
||||
fixture: 'apiGateway',
|
||||
configExt: {
|
||||
functions: {
|
||||
foo: {
|
||||
events: [
|
||||
{
|
||||
http: {
|
||||
integration: 'AWS',
|
||||
request: { template: { 'application/x-www-form-urlencoded': null } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
cliArgs: ['package'],
|
||||
});
|
||||
const apiGatewayMethodConfig = cfResources[awsNaming.getMethodLogicalId('Foo', 'GET')];
|
||||
|
||||
expect(apiGatewayMethodConfig.Properties.Integration.RequestTemplates).to.not.have.property(
|
||||
'application/x-www-form-urlencoded'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user