【问题标题】:GitHub release asset download with node.jsGitHub 使用 node.js 发布资产下载
【发布时间】:2015-08-22 01:11:39
【问题描述】:

我想使用 API 的 GitHub 版本中的 http.get 方法在 Node.js 中编写一个自动下载器,我收到 302 错误。我能做什么?

【问题讨论】:

    标签: node.js github github-api nw.js


    【解决方案1】:

    HTTP 302 不是错误:

    HTTP 响应 status code 302 Found 是执行URL redirection 的常用方式。

    您可以通过检索 Location 响应标头中显示的 URL 来处理 HTTP 302 Found。

    您可能要考虑使用the request library,而不是使用http.get,如this answer 中的建议。 request 应该会自动跟随重定向。

    【讨论】:

    • 感谢您的回答
    • 我是 stackoverflow 的新手,我不知道我必须这样做。
    猜你喜欢
    • 2021-08-01
    • 2022-11-04
    • 2017-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-06
    相关资源
    最近更新 更多