From 84ac9883d1f5cf1f3a01670e36509152011c1ad7 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 20 Jan 2021 22:47:12 -0800 Subject: [PATCH] * sending body data as prepared json to - removing pointless asserts - removed unused param in Request.make --- server-api/client-tests/web/http.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server-api/client-tests/web/http.py b/server-api/client-tests/web/http.py index 0e2a523..7db1d78 100644 --- a/server-api/client-tests/web/http.py +++ b/server-api/client-tests/web/http.py @@ -66,7 +66,6 @@ class Response: class Request: def __init__(self, method: str, url: str, params: dict): - assert(domain[len(domain) - 1] != '/') assert(method in ['get', 'post', 'delete']) self.method = method @@ -77,21 +76,22 @@ class Request: # Lower driver for actuall making the request we are looking for method = method.lower() + params = json.dumps(self.params) if method == 'get': - resp = requests.get(self.url, data=self.params) - return Response(self.url, resp.body, resp.status_code, hope) + resp = requests.get(self.url, data=params) + return Response(self.url, resp.text, resp.status_code, hope) elif method == 'post': - resp = requests.post(self.url, data=self.params) - return Response(self.url, resp.body, resp.status_code, hope) + resp = requests.post(self.url, data=self) + return Response(self.url, resp.text, resp.status_code, hope) elif method == 'delete': - resp = requests.delete(self.url, data=self.params) - return Response(self.url, resp.body, resp.status_code, hope) + resp = requests.delete(self.url, data=params) + return Response(self.url, resp.text, resp.status_code, hope) else: raise RequestError('Invalid method passed') - def make(self, hope: int, auth: str) -> Response: + def make(self, hope: int) -> Response: ''' @param hope: int -> status code we hope to get back @return Response -> Wrapper around server http response