From d0fef41f7b9d062a190847745ac2666c0065bfd0 Mon Sep 17 00:00:00 2001 From: Edward Hades Date: Wed, 7 Sep 2011 23:50:38 +0200 Subject: [PATCH] Client: avoid header corruption Before this the Client.request method was able to corrupt the headers dict passed by the user, since all complex objects are passed by reference. --- oauth2/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oauth2/__init__.py b/oauth2/__init__.py index 835270e3..736f3975 100644 --- a/oauth2/__init__.py +++ b/oauth2/__init__.py @@ -23,6 +23,7 @@ """ import base64 +import copy import urllib import time import random @@ -642,6 +643,8 @@ def request(self, uri, method="GET", body='', headers=None, if not isinstance(headers, dict): headers = {} + else: + headers = copy.copy(headers) if method == "POST": headers['Content-Type'] = headers.get('Content-Type',