Posted on April 15, 2020 at 9:37 am
You can modify the default request timeout like this:
var options = { url: 'https://www.google.com/', timeout: 120000 } request(options, function(err, resp, body) {}); |
Details of the param timeout can be found here:
https://github.com/request/request#user-content-requestoptions-callback
timeout - integer containing number of milliseconds, controls two timeouts. Read timeout: Time to wait for a server to send response headers (and start the response body) before aborting the request. Connection timeout: Sets the socket to timeout after timeout milliseconds of inactivity. Note that increasing the timeout beyond the OS-wide TCP connection timeout will not have any effect (the default in Linux can be anywhere from 20-120 seconds) |
Other Posts
- Detect VMWare Virtual Machine
- Detect Microsoft Virtual PC Virtual Machine
- Fix MariaDB 10.5 "Can't create test file" errors
- Use MariaDB and MySQL without Password (MySQL Backup)
- Check if a Trademark is already registered
- Make name server address permanent in /etc/resolv.conf
- InnoSetup error the servicemanager is not available
- InnoSetup disable DesktopIcon via command-line
Updated Posts
- Delphi 10 Berlin System.Hash MD5 SHA1 SHA2 Hash
- Use cURL to check for SSL certificate issues:
- How to test Socks5 proxy with cURL
- How to use variables in a sed command
- Best Socks5 Servers for Linux Debian
- Error NO_PUBKEY in Google Cloud Debian Packages Update
- How to Run a Command with Time Limit in Bash Linux
- MySQL InnoDB log sequence number is in the future