![](/img/trans.png)
[英]How to return HTML code from Lambda function in NodeJS?
[英]How to exit a NodeJs lambda function?
我有一个 lambda function 将用户重定向到某个 url 是否满足条件。 否则它什么都不做。
'use strict';
exports.handler = async (event, context, callback) => {
if ( a certain condition is met) {
const response = {
status: '302',
statusDescription: 'Found',
headers: {location:
[
{
key: 'Location',
value: 'https://www.yahoo.fr',
}
],
},
};
return response;
}
else {
// continue with the request
}
};
lambda function 在云端分发后处理观众请求。
当不满足条件时,我需要 lambda function 将请求发送到云前端分发而不更改任何内容。
有谁知道如何完成此 function 以使其继续原始请求?
谢谢干杯,
'use strict';
exports.handler = async (event, context, callback) => {
if ( a certain condition is met) {
const response = {
status: '302',
statusDescription: 'Found',
headers: {location:
[
{
key: 'Location',
value: 'https://www.yahoo.fr',
}
],
},
};
callback(null, response);
}
callback(null, request);
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.