sync-request
sync-request copied to clipboard
How to make "timeout" take effect
I use "sync-request" at node.js. I need to use a sync request for some reason. Requests may be interrupted due to network fluctuations. I tried to add a timeout to the sync-request configuration item, but it didn't take effect. this is code:
let res = syncRequest('GET', url, {
timeout: 5000,
socketTimeout: 5000,
maxRetries: 1,
retryDelay: 10
});
let result = res.getBody("utf8");
Is this what is the reason?
+1