鍍金池/ 問答/HTML/ node的request模塊timeout設(shè)置沒起作用原因是什么

node的request模塊timeout設(shè)置沒起作用原因是什么

clipboard.png
設(shè)置了一秒的超時(shí),但是抓取請求遠(yuǎn)遠(yuǎn)超過一秒了還是沒起作用,報(bào)超時(shí)的錯(cuò)誤

clipboard.png
打印看到整個(gè)請求都已經(jīng)5秒了,不知道這是啥原因

回答
編輯回答
款爺
wait for a server to send response headers (and start the response body) before aborting the request.

5秒是響應(yīng)完成5秒還是響應(yīng)開始時(shí)已經(jīng)5秒?
timeout只是接收body前是否超時(shí),開始接收body的那一刻起timeout就不管了。

2017年5月23日 18:31