{"action":"created","issue":{"url":"https://api.github.com/repos/php-http/adapter/issues/35","labels_url":"https://api.github.com/repos/php-http/adapter/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/php-http/adapter/issues/35/comments","events_url":"https://api.github.com/repos/php-http/adapter/issues/35/events","html_url":"https://github.com/php-http/adapter/issues/35","id":87875563,"number":35,"title":"Cookie handling","user":{"login":"sagikazarmark","id":1226384,"avatar_url":"https://avatars.githubusercontent.com/u/1226384?v=3","gravatar_id":"","url":"https://api.github.com/users/sagikazarmark","html_url":"https://github.com/sagikazarmark","followers_url":"https://api.github.com/users/sagikazarmark/followers","following_url":"https://api.github.com/users/sagikazarmark/following{/other_user}","gists_url":"https://api.github.com/users/sagikazarmark/gists{/gist_id}","starred_url":"https://api.github.com/users/sagikazarmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagikazarmark/subscriptions","organizations_url":"https://api.github.com/users/sagikazarmark/orgs","repos_url":"https://api.github.com/users/sagikazarmark/repos","events_url":"https://api.github.com/users/sagikazarmark/events{/privacy}","received_events_url":"https://api.github.com/users/sagikazarmark/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-12T23:03:30Z","updated_at":"2015-06-13T06:40:32Z","closed_at":null,"body":"@ddeboer mentioned that cookie handling should be possible from adapters.\r\n\r\nIn the Ivory adapter it was possible by using event dispatcher. I checked the Ivory and the Guzzle CookieJar implementation and they are really similar.\r\n\r\nThere are two ways to implement cookie handling:\r\n\r\n1. If the underlying client supports it pass a cookie option\r\n2. Force the use of an Event adapter which wraps the underlying adapter\r\n\r\nOption 2 would be the general solution because not all clients might support cookies. Ultimately the underlying client (like guzzle) would do the same: serialize the cookie jar and place it in the request header. "},"comment":{"url":"https://api.github.com/repos/php-http/adapter/issues/comments/111681085","html_url":"https://github.com/php-http/adapter/issues/35#issuecomment-111681085","issue_url":"https://api.github.com/repos/php-http/adapter/issues/35","id":111681085,"user":{"login":"sagikazarmark","id":1226384,"avatar_url":"https://avatars.githubusercontent.com/u/1226384?v=3","gravatar_id":"","url":"https://api.github.com/users/sagikazarmark","html_url":"https://github.com/sagikazarmark","followers_url":"https://api.github.com/users/sagikazarmark/followers","following_url":"https://api.github.com/users/sagikazarmark/following{/other_user}","gists_url":"https://api.github.com/users/sagikazarmark/gists{/gist_id}","starred_url":"https://api.github.com/users/sagikazarmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagikazarmark/subscriptions","organizations_url":"https://api.github.com/users/sagikazarmark/orgs","repos_url":"https://api.github.com/users/sagikazarmark/repos","events_url":"https://api.github.com/users/sagikazarmark/events{/privacy}","received_events_url":"https://api.github.com/users/sagikazarmark/received_events","type":"User","site_admin":false},"created_at":"2015-06-13T06:40:32Z","updated_at":"2015-06-13T06:40:32Z","body":"> In option 2, the event subscriber is a single, generic one for all adapters, isn't it?\r\n\r\nExactly.\r\n\r\n> 1, 2, 3\r\n\r\nExactly.\r\n\r\nOne thing in my mind: Since the PSR-7 messages are immutable, I am not completely sure that an event system is the best idea, because that way the listener would always have to set a message in the event. I am thinking about some sort of middleware system where you pass in the middleware (which plays the role of a listener) and it calls the next middleware in the chain by passing the modified (new) message to the next middleware in the queue.\r\n\r\nNot sure how Guzzle does this, since it also have some sort of event system. I am curious if listeners in guzzle always set the new message in the event or use some other logic."}}