mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import StringIO
|
||||
from six.moves.urllib.parse import urlparse, parse_qsl
|
||||
|
||||
|
||||
@@ -26,11 +27,16 @@ class Request(object):
|
||||
def __init__(self, method, uri, body, headers):
|
||||
self.method = method
|
||||
self.uri = uri
|
||||
self.body = body
|
||||
self._was_file = hasattr(body, 'read')
|
||||
self._body = body.read() if self._was_file else body
|
||||
self.headers = {}
|
||||
for key in headers:
|
||||
self.add_header(key, headers[key])
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
return StringIO.StringIO(self._body) if self._was_file else self._body
|
||||
|
||||
def add_header(self, key, value):
|
||||
# see class docstring for an explanation
|
||||
if isinstance(value, (tuple, list)):
|
||||
|
||||
Reference in New Issue
Block a user