{"action":"opened","issue":{"url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/5","repository_url":"https://api.github.com/repos/synapsestudios/synapi-client","labels_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/5/comments","events_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/5/events","html_url":"https://github.com/synapsestudios/synapi-client/issues/5","id":146481486,"number":5,"title":"Create middleware api","user":{"login":"spruce-bruce","id":59978,"avatar_url":"https://avatars.githubusercontent.com/u/59978?v=3","gravatar_id":"","url":"https://api.github.com/users/spruce-bruce","html_url":"https://github.com/spruce-bruce","followers_url":"https://api.github.com/users/spruce-bruce/followers","following_url":"https://api.github.com/users/spruce-bruce/following{/other_user}","gists_url":"https://api.github.com/users/spruce-bruce/gists{/gist_id}","starred_url":"https://api.github.com/users/spruce-bruce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spruce-bruce/subscriptions","organizations_url":"https://api.github.com/users/spruce-bruce/orgs","repos_url":"https://api.github.com/users/spruce-bruce/repos","events_url":"https://api.github.com/users/spruce-bruce/events{/privacy}","received_events_url":"https://api.github.com/users/spruce-bruce/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-07T01:28:17Z","updated_at":"2016-04-07T01:28:17Z","closed_at":null,"body":"Drawing inspiration from https://github.com/RickWong/fetch-plus\r\n\r\nA middleware is an object with up to 3 methods, all optional (though at least one should be provided, come on). Middleware should look like:\r\n\r\n```\r\nmodule.exports = (defaults, dispatcher) => {\r\n  return {\r\n    onStart : (request) => null,\r\n    onSuccess : (request, response) => null,\r\n    onFail : (request, response) => null,\r\n  }\r\n}\r\n```\r\n\r\n\r\nThe api for adding middleware will look like this:\r\n\r\n```\r\nimport MyMiddleware from 'MyMiddleware';\r\nclient.addMiddleware(MyMiddleware);\r\n```"}}