{"action":"created","issue":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/692","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/692/labels{/name}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/692/comments","events_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/692/events","html_url":"https://github.com/Alamofire/Alamofire/issues/692","id":101245885,"number":692,"title":"Adding Headers with ephemeralSessionConfiguration()","user":{"login":"Jeanblanc88","id":13817711,"avatar_url":"https://avatars.githubusercontent.com/u/13817711?v=3","gravatar_id":"","url":"https://api.github.com/users/Jeanblanc88","html_url":"https://github.com/Jeanblanc88","followers_url":"https://api.github.com/users/Jeanblanc88/followers","following_url":"https://api.github.com/users/Jeanblanc88/following{/other_user}","gists_url":"https://api.github.com/users/Jeanblanc88/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeanblanc88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeanblanc88/subscriptions","organizations_url":"https://api.github.com/users/Jeanblanc88/orgs","repos_url":"https://api.github.com/users/Jeanblanc88/repos","events_url":"https://api.github.com/users/Jeanblanc88/events{/privacy}","received_events_url":"https://api.github.com/users/Jeanblanc88/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/http%20headers","name":"http headers","color":"69B805"},{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/question","name":"question","color":"FF7E00"}],"state":"open","locked":false,"assignee":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Alamofire/Alamofire/milestones/7","html_url":"https://github.com/Alamofire/Alamofire/milestones/2.0.0","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/milestones/7/labels","id":1249310,"number":7,"title":"2.0.0","description":"","creator":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":3,"state":"open","created_at":"2015-08-11T02:14:11Z","updated_at":"2015-08-16T16:52:49Z","due_on":"2015-09-09T07:00:00Z","closed_at":null},"comments":4,"created_at":"2015-08-16T09:25:05Z","updated_at":"2015-08-17T06:54:40Z","closed_at":null,"body":"Hi,\r\n\r\nI am using the code you are suggesting on both:\r\n- using ephemeral sessions\r\n- adding header to any query\r\n\r\nThe problem is that mixing both (adding query to ephemeral sessions), does not work. I checked :\r\n\r\n    let configuration = NSURLSessionConfiguration.ephemeralSessionConfiguration()\r\n    let manager = Manager(configuration: configuration)\r\n    manager.session.configuration.HTTPAdditionalHeaders = [\"Authorization\": \"Bearer \\(accessToken!)\" ]\r\n\r\nDoing this does not add the header.\r\nIs there something I am missing?\r\n"},"comment":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/comments/131699315","html_url":"https://github.com/Alamofire/Alamofire/issues/692#issuecomment-131699315","issue_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/692","id":131699315,"user":{"login":"Jeanblanc88","id":13817711,"avatar_url":"https://avatars.githubusercontent.com/u/13817711?v=3","gravatar_id":"","url":"https://api.github.com/users/Jeanblanc88","html_url":"https://github.com/Jeanblanc88","followers_url":"https://api.github.com/users/Jeanblanc88/followers","following_url":"https://api.github.com/users/Jeanblanc88/following{/other_user}","gists_url":"https://api.github.com/users/Jeanblanc88/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeanblanc88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeanblanc88/subscriptions","organizations_url":"https://api.github.com/users/Jeanblanc88/orgs","repos_url":"https://api.github.com/users/Jeanblanc88/repos","events_url":"https://api.github.com/users/Jeanblanc88/events{/privacy}","received_events_url":"https://api.github.com/users/Jeanblanc88/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T06:54:40Z","updated_at":"2015-08-17T06:54:40Z","body":"So I managed to get the result by retaining the 'manager' as explained in https://github.com/Alamofire/Alamofire/issues/157\r\n\r\nHowever, I still have that caching problem which was the initial problem that led me to use customer Manager. I am using ephemeralSessionConfiguration(), but the request is still stored.\r\n\r\nDetails points:\r\n- When I just send the headers, the \"Cache-Control\" = \"must-revalidate, private, max-age=0\" part of my answer seem to be ignored, since redoing the query with other parameters returns the same answer. This led me to force the session not to cache the result by using ephemeralSessionConfiguration, but as you can see it does not work.\r\n- I also tried removing all cached responses with NSURLCache.sharedURLCache().removeAllCachedResponses() before making any new request, but it did not work as well.\r\n\r\nThank you!"}}