Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
const req = https.request(options, function (res) {
res.setEncoding('utf8');
res.on('data', function (body) {
resolve({ statusCode: res.statusCode })
});
});
req.on('error', function (e) {
// throw new Error(`Error updating Alexa Skill Endpoint`);
reject(e);
});
// write data to request body
req.write(JSON.stringify(body));
req.end();
})
}
return new Promise((resolve, reject) => {
const req = request(options, (res) => {
res.on('error', reject)
res.on('data', (buf) => console.log('marked', res.statusCode, buf.toString()))
res.on('end', resolve)
})
req.on('error', err => reject(err))
console.log('marking', data)
req.write(data)
req.end()
})
}
return new Promise((resolve, reject) => {
const req = https.request(options, (res) => {
res.on('error', reject)
res.on('data', (buf) => console.log('marked', res.statusCode, buf.toString()))
res.on('end', resolve)
})
req.on('error', err => reject(err))
console.log('marking', data)
req.write(data)
req.end()
})
}
return new Promise((resolve, reject) => {
var content = options.content;
var req = https.request(options, function (res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
resolve(chunk);
});
});
req.on('error', function (e) {
reject(e);
});
req.write(content);
req.end();
});
};
return new Promise((resolve, reject) => {
const request = https
.request(options, resolve);
request.on('error', error => reject(`send(..) failed executing https.request(..): ${error}`));
request.write(responseBody);
request.end();
})
.then(() => callback(responseStatus === FAILED ? responseStatus : null, responseData))