Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-request-timeout

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-request-timeout

Request timeout middleware for Express/Connect

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

connect-request-timeout

Request timeout middleware for Express/Connect

Install

npm install connect-request-timeout

Usage

var reqTimeout = require('connect-request-timeout');
app.use(reqTimeout() );

Documentation

require('connect-request-timeout')(options)

Returns Connect middleware that throws an error after the specified request timeout elapses.

Default behavior:

  • Delay defaults to DEFAULT_TIMEOUT, or DEFAULT_UPLOAD_TIMEOUT if Content-Type: multipart/form-data is set
  • Once the timer expires, an error is thrown
  • If res.writeHead or res.write are called before the timer expires, then the timer is reset. This may continue for a maximum of maxTimeout ms.

Options include:

  • timeout (defaults to 10 seconds)
  • uploadTimeout (defaults to 1 minute)
  • maxTimeout - the maximum number of ms to wait for a request even if the server is writing data to the ServerResponse Object (defaults to 10 mins.)
  • errorPrototype - the type of Error to throw (defaults to Error)

Functions added to the request object:

  • req.setTimeout([delay, errorProto]) - sets/resets the timeout for this request
  • req.clearTimeout() - clears the timeout for this request
  • req.getTimeout() - returns the timeout for this request, not the number of ms remaining.

Keywords

FAQs

Package last updated on 03 Jun 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc