{"action":"closed","issue":{"url":"https://api.github.com/repos/madewithlove/margaret-fetcher/issues/2","repository_url":"https://api.github.com/repos/madewithlove/margaret-fetcher","labels_url":"https://api.github.com/repos/madewithlove/margaret-fetcher/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/madewithlove/margaret-fetcher/issues/2/comments","events_url":"https://api.github.com/repos/madewithlove/margaret-fetcher/issues/2/events","html_url":"https://github.com/madewithlove/margaret-fetcher/issues/2","id":138096801,"number":2,"title":"More middleware-like approach","user":{"login":"bramdevries","id":1002245,"avatar_url":"https://avatars.githubusercontent.com/u/1002245?v=3","gravatar_id":"","url":"https://api.github.com/users/bramdevries","html_url":"https://github.com/bramdevries","followers_url":"https://api.github.com/users/bramdevries/followers","following_url":"https://api.github.com/users/bramdevries/following{/other_user}","gists_url":"https://api.github.com/users/bramdevries/gists{/gist_id}","starred_url":"https://api.github.com/users/bramdevries/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bramdevries/subscriptions","organizations_url":"https://api.github.com/users/bramdevries/orgs","repos_url":"https://api.github.com/users/bramdevries/repos","events_url":"https://api.github.com/users/bramdevries/events{/privacy}","received_events_url":"https://api.github.com/users/bramdevries/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/madewithlove/margaret-fetcher/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-03T07:17:27Z","updated_at":"2016-03-12T08:01:32Z","closed_at":"2016-03-12T08:01:32Z","body":"Currently the promises that handle a request are hard coded in the package, it would be nice if these promises were configurable somewhere. For example:\r\n\r\n```javascript\r\nclass AppRequest extends AbstractRequest\r\n{\r\n    constructor() {\r\n       super();\r\n\r\n       // Set the globally\r\n       this.middlewares = [\r\n           ::this.refreshAccessToken,\r\n           ::this.parseResponse,\r\n       ];\r\n    }\r\n\r\n    refreshAccessToken(response) {\r\n         // Logic to store the `Authorization` header \r\n     }\r\n}\r\n``` \r\n\r\nCould also do it per request:\r\n\r\n```javascript\r\nRequest.withMiddlewares([::thisParseResponse]).show(1)\r\n```"}}