Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Http request timeout for Node
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.npmignore
README.md
index.js
package.json
test.js

README.md

request-timeout

Http request timeout for Node

Installation

npm install request-timeout

Usage

var timeout = require('request-timeout')
var http = require('http')

var server = http.createServer(handleRequest)

function handleRequest(req, res) {
  timeout(req, res, 60) // set timeout to 60 seconds (default is 20)

  req.on('timeout', function() {
    console.log('The request timed out')
    res.end('The request timed out')
  })
}

server.listen(1137)
Something went wrong with that request. Please try again.