1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

Adding json serializer

This commit is contained in:
shu zOMG chen
2013-08-18 21:43:14 -10:00
committed by Kevin McCarthy
parent 3e247a2efb
commit 51f0f1bacd
10 changed files with 134 additions and 55 deletions

View File

@@ -7,7 +7,7 @@ class Request(object):
self.method = method
self.path = path
self.body = body
# make haders a frozenset so it will be hashable
# make headers a frozenset so it will be hashable
self.headers = frozenset(headers.items())
@property
@@ -28,3 +28,18 @@ class Request(object):
def __repr__(self):
return self.__str__()
def _to_dict(self):
return {
'protocol': self.protocol,
'host': self.host,
'port': self.port,
'method': self.method,
'path': self.path,
'body': self.body,
'headers': self.headers,
}
@classmethod
def _from_dict(cls, dct):
return Request(**dct)