{"action":"created","issue":{"url":"https://api.github.com/repos/trek/pretender/issues/48","labels_url":"https://api.github.com/repos/trek/pretender/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/trek/pretender/issues/48/comments","events_url":"https://api.github.com/repos/trek/pretender/issues/48/events","html_url":"https://github.com/trek/pretender/pull/48","id":52944166,"number":48,"title":"Async Responses","user":{"login":"DingoEatingFuzz","id":174740,"avatar_url":"https://avatars.githubusercontent.com/u/174740?v=3","gravatar_id":"","url":"https://api.github.com/users/DingoEatingFuzz","html_url":"https://github.com/DingoEatingFuzz","followers_url":"https://api.github.com/users/DingoEatingFuzz/followers","following_url":"https://api.github.com/users/DingoEatingFuzz/following{/other_user}","gists_url":"https://api.github.com/users/DingoEatingFuzz/gists{/gist_id}","starred_url":"https://api.github.com/users/DingoEatingFuzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DingoEatingFuzz/subscriptions","organizations_url":"https://api.github.com/users/DingoEatingFuzz/orgs","repos_url":"https://api.github.com/users/DingoEatingFuzz/repos","events_url":"https://api.github.com/users/DingoEatingFuzz/events{/privacy}","received_events_url":"https://api.github.com/users/DingoEatingFuzz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-27T00:36:13Z","updated_at":"2015-01-15T02:45:41Z","closed_at":"2015-01-14T19:19:55Z","pull_request":{"url":"https://api.github.com/repos/trek/pretender/pulls/48","html_url":"https://github.com/trek/pretender/pull/48","diff_url":"https://github.com/trek/pretender/pull/48.diff","patch_url":"https://github.com/trek/pretender/pull/48.patch"},"body":"PR for issue https://github.com/trek/pretender/issues/41\r\n\r\n- Makes responses asynchronous by default\r\n- Responses resolve on the next run of the event loop by default\r\n- Responses can be made synchronous by passing `false` for the async argument when specifying a route\r\n```js\r\npretender.get('/sync/thing', handlerFn, false)\r\n```\r\n- Responses can be set to resolve after a specified time by passing in a number for the async argument\r\n```js\r\npretender.get('/timed/thing', handlerFn, 300) // in ms just like setTimeout\r\n```\r\n- Responses can be set to never automatically resolve by passing in `true` for the async argument\r\n```js\r\npretender.get('/manual/thing', handlerFn, true);\r\n// ...\r\npretender.resolve(request);\r\n```\r\n- Responses can be set to conditionally resolve by passing in a function for the async argument\r\n```js\r\npretender.get('/maybe/async/thing', handlerFn, function() { return isAsync ? 0 : false; })\r\n```\r\n- A helper by the name of `pretender.requiresManualResolution` exists to check if a request will, well, require manual resolution."},"comment":{"url":"https://api.github.com/repos/trek/pretender/issues/comments/70032003","html_url":"https://github.com/trek/pretender/pull/48#issuecomment-70032003","issue_url":"https://api.github.com/repos/trek/pretender/issues/48","id":70032003,"user":{"login":"DingoEatingFuzz","id":174740,"avatar_url":"https://avatars.githubusercontent.com/u/174740?v=3","gravatar_id":"","url":"https://api.github.com/users/DingoEatingFuzz","html_url":"https://github.com/DingoEatingFuzz","followers_url":"https://api.github.com/users/DingoEatingFuzz/followers","following_url":"https://api.github.com/users/DingoEatingFuzz/following{/other_user}","gists_url":"https://api.github.com/users/DingoEatingFuzz/gists{/gist_id}","starred_url":"https://api.github.com/users/DingoEatingFuzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DingoEatingFuzz/subscriptions","organizations_url":"https://api.github.com/users/DingoEatingFuzz/orgs","repos_url":"https://api.github.com/users/DingoEatingFuzz/repos","events_url":"https://api.github.com/users/DingoEatingFuzz/events{/privacy}","received_events_url":"https://api.github.com/users/DingoEatingFuzz/received_events","type":"User","site_admin":false},"created_at":"2015-01-15T02:45:41Z","updated_at":"2015-01-15T02:45:41Z","body":"Yep, working on those changes now."}}