From 5487d162979c118260c95c9c35a64631905ef202 Mon Sep 17 00:00:00 2001 From: Felix Bechstein Date: Sun, 14 Jan 2018 20:47:27 +0100 Subject: [PATCH] Fix cancel order DELETE requests with None body were resulting in a 400 BadRequest. Before, the None was encoded to null. --- gdax/trader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdax/trader.py b/gdax/trader.py index df6155d..6221ec3 100644 --- a/gdax/trader.py +++ b/gdax/trader.py @@ -135,8 +135,12 @@ async def _post(self, path, data=None, decimal_return_fields=None, async def _delete(self, path, data=None, decimal_return_fields=None, convert_all=False): - json_data = json.dumps(data) - headers = self._auth_headers(path, method='DELETE', body=json_data) + if data: + json_data = json.dumps(data) + headers = self._auth_headers(path, method='DELETE', body=json_data) + else: + json_data = None + headers = self._auth_headers(path, method='DELETE') path_url = self.API_URL + path with async_timeout.timeout(self.timeout_sec): async with self.session.delete(path_url,