From f6ac20b819f86351d7ce16993a16dc025d0f32fa Mon Sep 17 00:00:00 2001 From: SanGuiChen <77064828+SanGuiChen@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:24:24 +0800 Subject: [PATCH] chore: followRedirect default value is true (#487) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 代码注释是对的,但是 readme 里的是错误的。 **readme:** ![image](https://github.com/node-modules/urllib/assets/77064828/7c4317d5-0659-41c3-af02-e5fa99714915) **代码:** ![image](https://github.com/node-modules/urllib/assets/77064828/5e9661af-97d8-4384-bc42-0f638705317e) ------------------------------------------------------------------------ 这里也写了个小 demo 验证了一番,确认 followRedirect 的默认值是 true: https://github.com/SanGuiChen/urllib-redirect-demo Co-authored-by: xuming.cx --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8398db3..ec5c9a63 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ console.log('status: %s, body size: %d, headers: %j', res.status, data.length, r - **keepAliveTimeout** `number | null` - Default is `4000`, 4 seconds - The timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. See [MDN: HTTP - Headers - Keep-Alive directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive#directives) for more details. - ***auth*** String - `username:password` used in HTTP Basic Authorization. - ***digestAuth*** String - `username:password` used in HTTP [Digest Authorization](https://en.wikipedia.org/wiki/Digest_access_authentication). - - ***followRedirect*** Boolean - follow HTTP 3xx responses as redirects. defaults to false. + - ***followRedirect*** Boolean - follow HTTP 3xx responses as redirects. defaults to true. - ***maxRedirects*** Number - The maximum number of redirects to follow, defaults to 10. - ***formatRedirectUrl*** Function - Format the redirect url by your self. Default is `url.resolve(from, to)`. - ***beforeRequest*** Function - Before request hook, you can change every thing here.