{"action":"created","issue":{"url":"https://api.github.com/repos/request/request/issues/1297","labels_url":"https://api.github.com/repos/request/request/issues/1297/labels{/name}","comments_url":"https://api.github.com/repos/request/request/issues/1297/comments","events_url":"https://api.github.com/repos/request/request/issues/1297/events","html_url":"https://github.com/request/request/pull/1297","id":50608706,"number":1297,"title":"Cast timeout to a number.","user":{"login":"Raynos","id":479538,"avatar_url":"https://avatars.githubusercontent.com/u/479538?v=3","gravatar_id":"","url":"https://api.github.com/users/Raynos","html_url":"https://github.com/Raynos","followers_url":"https://api.github.com/users/Raynos/followers","following_url":"https://api.github.com/users/Raynos/following{/other_user}","gists_url":"https://api.github.com/users/Raynos/gists{/gist_id}","starred_url":"https://api.github.com/users/Raynos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raynos/subscriptions","organizations_url":"https://api.github.com/users/Raynos/orgs","repos_url":"https://api.github.com/users/Raynos/repos","events_url":"https://api.github.com/users/Raynos/events{/privacy}","received_events_url":"https://api.github.com/users/Raynos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-02T03:31:07Z","updated_at":"2015-01-07T04:53:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/request/request/pulls/1297","html_url":"https://github.com/request/request/pull/1297","diff_url":"https://github.com/request/request/pull/1297.diff","patch_url":"https://github.com/request/request/pull/1297.patch"},"body":"This creates consistency in the timeout feature.\r\n\r\nThe `setTimeout` implementation in node will correctly cast any strings passed in to a number using `*= 1`\r\n\r\nThis means that \r\n\r\n```js\r\nrequest({\r\n  uri: '/foo',\r\n  timeout: '5000'\r\n}, cb);\r\n```\r\n\r\nwill work as expected.\r\n\r\n**HOWEVER** the `req.setTimeout` method does not cast strings to number. It instead defaults to no timeout when passed a string. \r\n\r\nTo guard against this bug in node core we manually cast the string to a number in `request/request` itself so that it is consistent."},"comment":{"url":"https://api.github.com/repos/request/request/issues/comments/68978836","html_url":"https://github.com/request/request/pull/1297#issuecomment-68978836","issue_url":"https://api.github.com/repos/request/request/issues/1297","id":68978836,"user":{"login":"FredKSchott","id":622227,"avatar_url":"https://avatars.githubusercontent.com/u/622227?v=3","gravatar_id":"","url":"https://api.github.com/users/FredKSchott","html_url":"https://github.com/FredKSchott","followers_url":"https://api.github.com/users/FredKSchott/followers","following_url":"https://api.github.com/users/FredKSchott/following{/other_user}","gists_url":"https://api.github.com/users/FredKSchott/gists{/gist_id}","starred_url":"https://api.github.com/users/FredKSchott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FredKSchott/subscriptions","organizations_url":"https://api.github.com/users/FredKSchott/orgs","repos_url":"https://api.github.com/users/FredKSchott/repos","events_url":"https://api.github.com/users/FredKSchott/events{/privacy}","received_events_url":"https://api.github.com/users/FredKSchott/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T04:53:14Z","updated_at":"2015-01-07T04:53:14Z","body":"If you're saying its a problem that Node's `request` object doesn't accept a string value for `request.setTimeout()`, then wouldn't the correct solution be to fix that behavior in node itself? Adding a fix here just moves our behavior farther away from Node's request object without fixing the core problem for all other Node `request` object consumers. "}}