{"action":"created","issue":{"url":"https://api.github.com/repos/bblimke/webmock/issues/617","repository_url":"https://api.github.com/repos/bblimke/webmock","labels_url":"https://api.github.com/repos/bblimke/webmock/issues/617/labels{/name}","comments_url":"https://api.github.com/repos/bblimke/webmock/issues/617/comments","events_url":"https://api.github.com/repos/bblimke/webmock/issues/617/events","html_url":"https://github.com/bblimke/webmock/issues/617","id":153741565,"number":617,"title":"Bearer authorisation not working in webmock 2.x but worked in 1.x","user":{"login":"TTransmit","id":2356515,"avatar_url":"https://avatars.githubusercontent.com/u/2356515?v=3","gravatar_id":"","url":"https://api.github.com/users/TTransmit","html_url":"https://github.com/TTransmit","followers_url":"https://api.github.com/users/TTransmit/followers","following_url":"https://api.github.com/users/TTransmit/following{/other_user}","gists_url":"https://api.github.com/users/TTransmit/gists{/gist_id}","starred_url":"https://api.github.com/users/TTransmit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TTransmit/subscriptions","organizations_url":"https://api.github.com/users/TTransmit/orgs","repos_url":"https://api.github.com/users/TTransmit/repos","events_url":"https://api.github.com/users/TTransmit/events{/privacy}","received_events_url":"https://api.github.com/users/TTransmit/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-09T09:57:15Z","updated_at":"2016-05-20T12:27:35Z","closed_at":"2016-05-20T12:25:49Z","body":"The following line of code successfully stubbed requests in 1.x but isn't working in 2.x. \r\n\r\n    stub_request(:get, \"https://www.example.com/example-endpoint\").with({headers: {'Authorization'=>\"Bearer #{oauth_token}\"}}).to_return(:body => mock_response)\r\n\r\nThe Bearer Authorization header is being overwritten with a 'Basic xxxxx' Authorization header. \r\n\r\nCommenting out lines 183-185 in em_http_request_adapter.rb makes the tests work with web mock 2.0.1\r\n\r\n        # if headers['authorization']\r\n        #   headers['Authorization'] = WebMock::Util::Headers.basic_auth_header(headers.delete('authorization'))\r\n        # end\r\n\r\nIn the 2.0.0 changelog, it suggests writing such a request as \r\n\r\n    stub_request(:get, \"www.example.com\").\r\n      with(headers: 'Authorization' => \"Basic #{ Base64.encode64('user:pass').chomp}\")\r\n\r\nwhich Ruby cannot interpret. \r\n\r\nThe change seems to have been made in this commit: \r\nhttps://github.com/bblimke/webmock/commit/edfafd2b821dd1f49c1e5d774907b44aab049e8f"},"comment":{"url":"https://api.github.com/repos/bblimke/webmock/issues/comments/220592437","html_url":"https://github.com/bblimke/webmock/issues/617#issuecomment-220592437","issue_url":"https://api.github.com/repos/bblimke/webmock/issues/617","id":220592437,"user":{"login":"bblimke","id":15547,"avatar_url":"https://avatars.githubusercontent.com/u/15547?v=3","gravatar_id":"","url":"https://api.github.com/users/bblimke","html_url":"https://github.com/bblimke","followers_url":"https://api.github.com/users/bblimke/followers","following_url":"https://api.github.com/users/bblimke/following{/other_user}","gists_url":"https://api.github.com/users/bblimke/gists{/gist_id}","starred_url":"https://api.github.com/users/bblimke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bblimke/subscriptions","organizations_url":"https://api.github.com/users/bblimke/orgs","repos_url":"https://api.github.com/users/bblimke/repos","events_url":"https://api.github.com/users/bblimke/events{/privacy}","received_events_url":"https://api.github.com/users/bblimke/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T12:27:34Z","updated_at":"2016-05-20T12:27:34Z","body":"cheers! :)"}}
{"actor":{"display_login":"bblimke"}}