代码之家  ›  专栏  ›  技术社区  ›  user1451111

节点.jshttps模块“无法确定域名”

  •  0
  • user1451111  · 技术社区  · 7 年前

    我要走了

    无法确定域名

    使用时出错 https.get 在节点.js应用程序。

    const options = {
                        hostname: hostname,
                        port: 443,
                        path: remotePDFFilePath,
                        method: 'GET'
                    };
    https.get(hostname + remotePDFFilePath, res => {
        res.setEncoding("base64");
        let body = "";
        res.on("data", data => {
            body += data;
        });
        res.on("end", () => {
            callback(null, {
                status: 1,
                response: body.toString('base64')
            });
        });
    });
    

    https 带的模块 http

    的值 hostname 是“ “以及 remotePDFFilePath 是“

    0 回复  |  直到 7 年前
    推荐文章