{"action":"created","comment":{"url":"https://api.github.com/repos/kevin1024/vcrpy/pulls/comments/33889492","id":33889492,"diff_hunk":"@@ -30,12 +32,29 @@ def query(r1, r2):\n     return r1.query == r2.query\n \n \n-def body(r1, r2):\n+def raw_body(r1, r2):\n     if hasattr(r1.body, 'read') and hasattr(r2.body, 'read'):\n         return r1.body.read() == r2.body.read()\n     return r1.body == r2.body\n \n \n+def body(r1, r2):\n+    if hasattr(r1.body, 'read') and hasattr(r2.body, 'read'):\n+        r1_body = r1.body.read()\n+        r2_body  = r2.body.read()\n+    else:\n+        r1_body = r1.body\n+        r2_body  = r2.body\n+    if r1.headers.get('Content-Type') == r2.headers.get('Content-Type') == 'application/x-www-form-urlencoded':","path":"vcr/matchers.py","position":24,"original_position":24,"commit_id":"3986caf182c546e4159fdafb839559ecf956b9c6","original_commit_id":"3986caf182c546e4159fdafb839559ecf956b9c6","user":{"login":"kevin1024","id":21099,"avatar_url":"https://avatars.githubusercontent.com/u/21099?v=3","gravatar_id":"","url":"https://api.github.com/users/kevin1024","html_url":"https://github.com/kevin1024","followers_url":"https://api.github.com/users/kevin1024/followers","following_url":"https://api.github.com/users/kevin1024/following{/other_user}","gists_url":"https://api.github.com/users/kevin1024/gists{/gist_id}","starred_url":"https://api.github.com/users/kevin1024/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevin1024/subscriptions","organizations_url":"https://api.github.com/users/kevin1024/orgs","repos_url":"https://api.github.com/users/kevin1024/repos","events_url":"https://api.github.com/users/kevin1024/events{/privacy}","received_events_url":"https://api.github.com/users/kevin1024/received_events","type":"User","site_admin":false},"body":"I would rather not add requests as a dependency.\r\n\r\nWe also have to be careful here - the requests implementation of CaseInsensitiveDict lowercases the header keys.  Someone might actually care about the capitalization of headers.  Yeah there's something in the RFC that says headers are case-insensitive, but I think keeping VCR transparent is very important.\r\n\r\nSince VCR is used mainly for integration tests, it should pass through all the weirdness of the server and client that it's working with, that way it can help find bugs in both.  It shouldn't be helping out by changing headers.\r\n\r\nBut yeah, the header comparison should probably be case-insensitive for our \"smart body matcher\".  Just don't store them that way.","created_at":"2015-07-04T19:23:06Z","updated_at":"2015-07-04T19:23:06Z","html_url":"https://github.com/kevin1024/vcrpy/pull/167#discussion_r33889492","pull_request_url":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167","_links":{"self":{"href":"https://api.github.com/repos/kevin1024/vcrpy/pulls/comments/33889492"},"html":{"href":"https://github.com/kevin1024/vcrpy/pull/167#discussion_r33889492"},"pull_request":{"href":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167"}}},"pull_request":{"url":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167","id":39207163,"html_url":"https://github.com/kevin1024/vcrpy/pull/167","diff_url":"https://github.com/kevin1024/vcrpy/pull/167.diff","patch_url":"https://github.com/kevin1024/vcrpy/pull/167.patch","issue_url":"https://api.github.com/repos/kevin1024/vcrpy/issues/167","number":167,"state":"open","locked":false,"title":"Improve body matcher using Content-Type based approach","user":{"login":"Diaoul","id":319220,"avatar_url":"https://avatars.githubusercontent.com/u/319220?v=3","gravatar_id":"","url":"https://api.github.com/users/Diaoul","html_url":"https://github.com/Diaoul","followers_url":"https://api.github.com/users/Diaoul/followers","following_url":"https://api.github.com/users/Diaoul/following{/other_user}","gists_url":"https://api.github.com/users/Diaoul/gists{/gist_id}","starred_url":"https://api.github.com/users/Diaoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diaoul/subscriptions","organizations_url":"https://api.github.com/users/Diaoul/orgs","repos_url":"https://api.github.com/users/Diaoul/repos","events_url":"https://api.github.com/users/Diaoul/events{/privacy}","received_events_url":"https://api.github.com/users/Diaoul/received_events","type":"User","site_admin":false},"body":"Fixes #166","created_at":"2015-07-04T12:30:53Z","updated_at":"2015-07-04T19:23:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b2ba7e43a89ac887363a52cc07d330d36699966","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167/commits","review_comments_url":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167/comments","review_comment_url":"https://api.github.com/repos/kevin1024/vcrpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kevin1024/vcrpy/issues/167/comments","statuses_url":"https://api.github.com/repos/kevin1024/vcrpy/statuses/3986caf182c546e4159fdafb839559ecf956b9c6","head":{"label":"Diaoul:master","ref":"master","sha":"3986caf182c546e4159fdafb839559ecf956b9c6","user":{"login":"Diaoul","id":319220,"avatar_url":"https://avatars.githubusercontent.com/u/319220?v=3","gravatar_id":"","url":"https://api.github.com/users/Diaoul","html_url":"https://github.com/Diaoul","followers_url":"https://api.github.com/users/Diaoul/followers","following_url":"https://api.github.com/users/Diaoul/following{/other_user}","gists_url":"https://api.github.com/users/Diaoul/gists{/gist_id}","starred_url":"https://api.github.com/users/Diaoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diaoul/subscriptions","organizations_url":"https://api.github.com/users/Diaoul/orgs","repos_url":"https://api.github.com/users/Diaoul/repos","events_url":"https://api.github.com/users/Diaoul/events{/privacy}","received_events_url":"https://api.github.com/users/Diaoul/received_events","type":"User","site_admin":false},"repo":{"id":38531289,"name":"vcrpy","full_name":"Diaoul/vcrpy","owner":{"login":"Diaoul","id":319220,"avatar_url":"https://avatars.githubusercontent.com/u/319220?v=3","gravatar_id":"","url":"https://api.github.com/users/Diaoul","html_url":"https://github.com/Diaoul","followers_url":"https://api.github.com/users/Diaoul/followers","following_url":"https://api.github.com/users/Diaoul/following{/other_user}","gists_url":"https://api.github.com/users/Diaoul/gists{/gist_id}","starred_url":"https://api.github.com/users/Diaoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diaoul/subscriptions","organizations_url":"https://api.github.com/users/Diaoul/orgs","repos_url":"https://api.github.com/users/Diaoul/repos","events_url":"https://api.github.com/users/Diaoul/events{/privacy}","received_events_url":"https://api.github.com/users/Diaoul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Diaoul/vcrpy","description":"Automatically mock your HTTP interactions to simplify and speed up testing","fork":true,"url":"https://api.github.com/repos/Diaoul/vcrpy","forks_url":"https://api.github.com/repos/Diaoul/vcrpy/forks","keys_url":"https://api.github.com/repos/Diaoul/vcrpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Diaoul/vcrpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Diaoul/vcrpy/teams","hooks_url":"https://api.github.com/repos/Diaoul/vcrpy/hooks","issue_events_url":"https://api.github.com/repos/Diaoul/vcrpy/issues/events{/number}","events_url":"https://api.github.com/repos/Diaoul/vcrpy/events","assignees_url":"https://api.github.com/repos/Diaoul/vcrpy/assignees{/user}","branches_url":"https://api.github.com/repos/Diaoul/vcrpy/branches{/branch}","tags_url":"https://api.github.com/repos/Diaoul/vcrpy/tags","blobs_url":"https://api.github.com/repos/Diaoul/vcrpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Diaoul/vcrpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Diaoul/vcrpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Diaoul/vcrpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Diaoul/vcrpy/statuses/{sha}","languages_url":"https://api.github.com/repos/Diaoul/vcrpy/languages","stargazers_url":"https://api.github.com/repos/Diaoul/vcrpy/stargazers","contributors_url":"https://api.github.com/repos/Diaoul/vcrpy/contributors","subscribers_url":"https://api.github.com/repos/Diaoul/vcrpy/subscribers","subscription_url":"https://api.github.com/repos/Diaoul/vcrpy/subscription","commits_url":"https://api.github.com/repos/Diaoul/vcrpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Diaoul/vcrpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Diaoul/vcrpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Diaoul/vcrpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Diaoul/vcrpy/contents/{+path}","compare_url":"https://api.github.com/repos/Diaoul/vcrpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Diaoul/vcrpy/merges","archive_url":"https://api.github.com/repos/Diaoul/vcrpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Diaoul/vcrpy/downloads","issues_url":"https://api.github.com/repos/Diaoul/vcrpy/issues{/number}","pulls_url":"https://api.github.com/repos/Diaoul/vcrpy/pulls{/number}","milestones_url":"https://api.github.com/repos/Diaoul/vcrpy/milestones{/number}","notifications_url":"https://api.github.com/repos/Diaoul/vcrpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Diaoul/vcrpy/labels{/name}","releases_url":"https://api.github.com/repos/Diaoul/vcrpy/releases{/id}","created_at":"2015-07-04T11:09:10Z","updated_at":"2015-07-04T11:09:11Z","pushed_at":"2015-07-04T17:21:37Z","git_url":"git://github.com/Diaoul/vcrpy.git","ssh_url":"git@github.com:Diaoul/vcrpy.git","clone_url":"https://github.com/Diaoul/vcrpy.git","svn_url":"https://github.com/Diaoul/vcrpy","homepage":"","size":2374,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kevin1024:master","ref":"master","sha":"cc6c26646cb7b37f199decb86d3b8b89ed39def4","user":{"login":"kevin1024","id":21099,"avatar_url":"https://avatars.githubusercontent.com/u/21099?v=3","gravatar_id":"","url":"https://api.github.com/users/kevin1024","html_url":"https://github.com/kevin1024","followers_url":"https://api.github.com/users/kevin1024/followers","following_url":"https://api.github.com/users/kevin1024/following{/other_user}","gists_url":"https://api.github.com/users/kevin1024/gists{/gist_id}","starred_url":"https://api.github.com/users/kevin1024/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevin1024/subscriptions","organizations_url":"https://api.github.com/users/kevin1024/orgs","repos_url":"https://api.github.com/users/kevin1024/repos","events_url":"https://api.github.com/users/kevin1024/events{/privacy}","received_events_url":"https://api.github.com/users/kevin1024/received_events","type":"User","site_admin":false},"repo":{"id":4477733,"name":"vcrpy","full_name":"kevin1024/vcrpy","owner":{"login":"kevin1024","id":21099,"avatar_url":"https://avatars.githubusercontent.com/u/21099?v=3","gravatar_id":"","url":"https://api.github.com/users/kevin1024","html_url":"https://github.com/kevin1024","followers_url":"https://api.github.com/users/kevin1024/followers","following_url":"https://api.github.com/users/kevin1024/following{/other_user}","gists_url":"https://api.github.com/users/kevin1024/gists{/gist_id}","starred_url":"https://api.github.com/users/kevin1024/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevin1024/subscriptions","organizations_url":"https://api.github.com/users/kevin1024/orgs","repos_url":"https://api.github.com/users/kevin1024/repos","events_url":"https://api.github.com/users/kevin1024/events{/privacy}","received_events_url":"https://api.github.com/users/kevin1024/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kevin1024/vcrpy","description":"Automatically mock your HTTP interactions to simplify and speed up testing","fork":false,"url":"https://api.github.com/repos/kevin1024/vcrpy","forks_url":"https://api.github.com/repos/kevin1024/vcrpy/forks","keys_url":"https://api.github.com/repos/kevin1024/vcrpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kevin1024/vcrpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kevin1024/vcrpy/teams","hooks_url":"https://api.github.com/repos/kevin1024/vcrpy/hooks","issue_events_url":"https://api.github.com/repos/kevin1024/vcrpy/issues/events{/number}","events_url":"https://api.github.com/repos/kevin1024/vcrpy/events","assignees_url":"https://api.github.com/repos/kevin1024/vcrpy/assignees{/user}","branches_url":"https://api.github.com/repos/kevin1024/vcrpy/branches{/branch}","tags_url":"https://api.github.com/repos/kevin1024/vcrpy/tags","blobs_url":"https://api.github.com/repos/kevin1024/vcrpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kevin1024/vcrpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kevin1024/vcrpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/kevin1024/vcrpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kevin1024/vcrpy/statuses/{sha}","languages_url":"https://api.github.com/repos/kevin1024/vcrpy/languages","stargazers_url":"https://api.github.com/repos/kevin1024/vcrpy/stargazers","contributors_url":"https://api.github.com/repos/kevin1024/vcrpy/contributors","subscribers_url":"https://api.github.com/repos/kevin1024/vcrpy/subscribers","subscription_url":"https://api.github.com/repos/kevin1024/vcrpy/subscription","commits_url":"https://api.github.com/repos/kevin1024/vcrpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/kevin1024/vcrpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/kevin1024/vcrpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/kevin1024/vcrpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/kevin1024/vcrpy/contents/{+path}","compare_url":"https://api.github.com/repos/kevin1024/vcrpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kevin1024/vcrpy/merges","archive_url":"https://api.github.com/repos/kevin1024/vcrpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kevin1024/vcrpy/downloads","issues_url":"https://api.github.com/repos/kevin1024/vcrpy/issues{/number}","pulls_url":"https://api.github.com/repos/kevin1024/vcrpy/pulls{/number}","milestones_url":"https://api.github.com/repos/kevin1024/vcrpy/milestones{/number}","notifications_url":"https://api.github.com/repos/kevin1024/vcrpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kevin1024/vcrpy/labels{/name}","releases_url":"https://api.github.com/repos/kevin1024/vcrpy/releases{/id}","created_at":"2012-05-29T04:52:00Z","updated_at":"2015-07-03T08:54:47Z","pushed_at":"2015-07-04T17:21:37Z","git_url":"git://github.com/kevin1024/vcrpy.git","ssh_url":"git@github.com:kevin1024/vcrpy.git","clone_url":"https://github.com/kevin1024/vcrpy.git","svn_url":"https://github.com/kevin1024/vcrpy","homepage":"","size":2374,"stargazers_count":423,"watchers_count":423,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":15,"forks":66,"open_issues":15,"watchers":423,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167"},"html":{"href":"https://github.com/kevin1024/vcrpy/pull/167"},"issue":{"href":"https://api.github.com/repos/kevin1024/vcrpy/issues/167"},"comments":{"href":"https://api.github.com/repos/kevin1024/vcrpy/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/kevin1024/vcrpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kevin1024/vcrpy/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/kevin1024/vcrpy/statuses/3986caf182c546e4159fdafb839559ecf956b9c6"}}}}