@seratch_/bolt-fastify
Version:
Bolt for JavaScript Extension - Fastify
35 lines • 1.27 kB
JavaScript
;
/* eslint-disable import/prefer-default-export */
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildContentResponse = exports.buildSSLCheckResponse = exports.buildUrlVerificationResponse = exports.buildNoBodyResponse = void 0;
function buildNoBodyResponse(res, status) {
res.writeHead(status);
}
exports.buildNoBodyResponse = buildNoBodyResponse;
function buildUrlVerificationResponse(res, body) {
res.writeHead(200, { 'content-type': 'application/json' });
res.end(JSON.stringify({ challenge: body.challenge }));
}
exports.buildUrlVerificationResponse = buildUrlVerificationResponse;
function buildSSLCheckResponse(res) {
res.writeHead(200);
res.end();
}
exports.buildSSLCheckResponse = buildSSLCheckResponse;
function buildContentResponse(res, body) {
if (!body) {
res.writeHead(200);
res.end();
}
else if (typeof body === 'string') {
res.writeHead(200);
res.end(body);
}
else {
res.writeHead(200, { 'content-type': 'application/json' });
res.end(JSON.stringify(body));
}
}
exports.buildContentResponse = buildContentResponse;
//# sourceMappingURL=http-response-builder.js.map