UNPKG

hiproxy

Version:

hiproxy - lightweight and powerful proxy tool for front-end developer based on Node.js.

19 lines (17 loc) 599 B
/** * @file hiproxy ssl-certificate route * @author zdying */ module.exports = function (request, response) { var certTool = require('../../src/helpers/certTool'); var os = require('os'); var cert = certTool.getCACertificate(); var content = cert.certificatePem; response.writeHead(200, { 'Content-Disposition': 'attachment; filename="Hiproxy-Custom-CA-Certificate-' + os.hostname().replace(/[\._]/g, '-') + '.crt"', 'Content-Type': 'application/force-download', 'Content-Transfer-Encoding': 'binary', 'Content-Length': content.length }); response.end(content); };