1
在API级别更新正文映射模板的正确javascript API是什么? updateIntegrationResponse无法在此级别完成使用javascript SDK在API级别更新aws apigateway正文映射模板
在API级别更新正文映射模板的正确javascript API是什么? updateIntegrationResponse无法在此级别完成使用javascript SDK在API级别更新aws apigateway正文映射模板
我们最终使用下面的api。有点棘手的部分是你需要用〜1来替换斜线以使其工作。
const params = {
responseType: response.type.toString(), /* required */
restApiId: apiId, /* required */
patchOperations:[{
op: 'add',
path: '/responseTemplates/'+ response.bodyMappingTemplate.contentType.replace("/", "~1"),
value: response.bodyMappingTemplate.content
}
]
};
this.apiGatewaySDK.updateGatewayResponse(params, (err, data) => {
if (err) {
reject(err);
}
else {
this.serverless.cli.log('API Gateway Configuring: Body mapping templates are set correctly');
resolve('Body Mapping Templates set successfully:', response.type);
}
});