follow-redirects 可以直接替换node http & https 的npm 模块

follow-redirects 可以直接替换node http & https 的npm 模块

包含的特性

  • 支持重定向功能
  • 支持重定向参数配置,比如最大重定向,以及最大请求大小,支持beforeredirect 请求处理(比如认证处理)
  • 支持agents

说明

对于业务系统的请求会包含重定向场景的,follow-redirects 是一个很不错的选择,而且使用简单,主要把以前的https 引用修改下就可以了
比如在开发unpkg 支持淘宝registry 的时候就可以快速解决因为重定向引起的问题

参考资料

https://github.com/follow-redirects/follow-redirects
https://www.npmjs.com/package/follow-redirects

posted on 2024-02-24 21:19  荣锋亮  阅读(56)  评论(0编辑  收藏  举报

导航