{"action":"created","issue":{"url":"https://api.github.com/repos/cloudant/sync-android/issues/136","labels_url":"https://api.github.com/repos/cloudant/sync-android/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/cloudant/sync-android/issues/136/comments","events_url":"https://api.github.com/repos/cloudant/sync-android/issues/136/events","html_url":"https://github.com/cloudant/sync-android/pull/136","id":78936198,"number":136,"title":"44538 filter pipeline and cookie filter.","user":{"login":"rhyshort","id":1616727,"avatar_url":"https://avatars.githubusercontent.com/u/1616727?v=3","gravatar_id":"","url":"https://api.github.com/users/rhyshort","html_url":"https://github.com/rhyshort","followers_url":"https://api.github.com/users/rhyshort/followers","following_url":"https://api.github.com/users/rhyshort/following{/other_user}","gists_url":"https://api.github.com/users/rhyshort/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyshort/subscriptions","organizations_url":"https://api.github.com/users/rhyshort/orgs","repos_url":"https://api.github.com/users/rhyshort/repos","events_url":"https://api.github.com/users/rhyshort/events{/privacy}","received_events_url":"https://api.github.com/users/rhyshort/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-21T10:36:37Z","updated_at":"2015-06-05T16:24:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cloudant/sync-android/pulls/136","html_url":"https://github.com/cloudant/sync-android/pull/136","diff_url":"https://github.com/cloudant/sync-android/pull/136.diff","patch_url":"https://github.com/cloudant/sync-android/pull/136.patch"},"body":"What:\r\n\r\nIntroduce filter pipeline for modifying requests and replaying requests based on responses. Also add a cookie filter to make use of the filtering mechanism.\r\n\r\nWhy:\r\n\r\nEnables developers to add information to http request their system may need, for example tokens for \r\ntheir proxy set up. The most asked for authentication method is cookie, as a result I have directly\r\nimplemented the filter for their use and as a way of \"dog fooding\" our filter API.\r\n\r\nHow:\r\n\r\nTwo interfaces, one for interacting with requests and one for responses. Request filters\r\nimplement the `HttpConnectionRequestFilter` interface, response filters should implement `HttpConnectionResponseFilter` interface. A class can implement both interfaces without \r\ncollision, the methods to implement are called `filterRequest` and `filterResponse` respectively.  \r\n\r\nCookie filter interacts with both requests and responses to correctly get and set the \r\ncookie for requests with couch/cloudant. It will instruct the HttpConnection to replay requests in the event of a 401 error.\r\n\r\nTesting:\r\n\r\nSet up a local couch server with an admin, along with a protected database called \"cookie_test\". Test should be able to add a document containing \"hello:world\" into the database.\r\n\r\n\r\nreviewer @mikerhodes \r\nreviewer @tomblench "},"comment":{"url":"https://api.github.com/repos/cloudant/sync-android/issues/comments/109351956","html_url":"https://github.com/cloudant/sync-android/pull/136#issuecomment-109351956","issue_url":"https://api.github.com/repos/cloudant/sync-android/issues/136","id":109351956,"user":{"login":"mikerhodes","id":453210,"avatar_url":"https://avatars.githubusercontent.com/u/453210?v=3","gravatar_id":"","url":"https://api.github.com/users/mikerhodes","html_url":"https://github.com/mikerhodes","followers_url":"https://api.github.com/users/mikerhodes/followers","following_url":"https://api.github.com/users/mikerhodes/following{/other_user}","gists_url":"https://api.github.com/users/mikerhodes/gists{/gist_id}","starred_url":"https://api.github.com/users/mikerhodes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikerhodes/subscriptions","organizations_url":"https://api.github.com/users/mikerhodes/orgs","repos_url":"https://api.github.com/users/mikerhodes/repos","events_url":"https://api.github.com/users/mikerhodes/events{/privacy}","received_events_url":"https://api.github.com/users/mikerhodes/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T16:24:50Z","updated_at":"2015-06-05T16:24:50Z","body":"Overall I'd like to see a bunch more docs about what filters are able to safely do. "}}