in source/witch/witch.js [60:107]
function respond(
event,
context,
responseStatus,
responseData,
physicalResourceId,
noEcho
) {
const responseBody = JSON.stringify({
Status: responseStatus,
Reason:
"See the details in CloudWatch Log Stream: " + context.logStreamName,
PhysicalResourceId: physicalResourceId || context.logStreamName,
StackId: event.StackId,
RequestId: event.RequestId,
LogicalResourceId: event.LogicalResourceId,
NoEcho: noEcho || false,
Data: responseData,
});
console.log("Response body:\n", responseBody);
const { pathname, hostname, search } = new url.URL(event.ResponseURL);
const options = {
hostname,
port: 443,
path: pathname + search,
method: "PUT",
headers: {
"content-type": "",
"content-length": responseBody.length,
},
};
const request = https.request(options, function (response) {
console.log("Status code: " + response.statusCode);
console.log("Status message: " + response.statusMessage);
context.done();
});
request.on("error", function (error) {
console.log("send(..) failed executing https.request(..): " + error);
context.done();
});
request.write(responseBody);
request.end();
}