Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

superagent 怎么请求到 301 跳转前的网页代码?

$
0
0

比如说 http://sf.gg网站,直接用 superagent 请求到的是 301 跳转后的 https://segmentfault.com的内容,我用 curl 命令获取 http://sf.gg的内容如下:

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>

我希望得到 301 前也就是如上的内容,如何用 superagent 实现? 看到 superagent 有个 Following redirects,这个需求和这个有关系吗?有的话应该怎么用?搞了很久没实现

望赐教,谢谢!


Viewing all articles
Browse latest Browse all 14821

Trending Articles