From 9af88bf20636fe9009060b5dd0cec42f6c8736d6 Mon Sep 17 00:00:00 2001 From: Terry Cain Date: Fri, 29 Sep 2017 23:43:03 +0100 Subject: [PATCH] Fixed batch errors --- moto/batch/responses.py | 7 +++++-- moto/batch/urls.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/moto/batch/responses.py b/moto/batch/responses.py index 80aedcf70..590cc27a4 100644 --- a/moto/batch/responses.py +++ b/moto/batch/responses.py @@ -22,10 +22,13 @@ class BatchResponse(BaseResponse): @property def json(self): - if self.body is None: + if self.body is None or self.body == '': self._json = {} elif not hasattr(self, '_json'): - self._json = json.loads(self.body) + try: + self._json = json.loads(self.body) + except json.JSONDecodeError: + print() return self._json def _get_param(self, param_name, if_none=None): diff --git a/moto/batch/urls.py b/moto/batch/urls.py index 9ad3db06f..18de99199 100644 --- a/moto/batch/urls.py +++ b/moto/batch/urls.py @@ -6,6 +6,6 @@ url_bases = [ ] url_paths = { - '{0}/v1/createcomputeenvironment': BatchResponse.dispatch, - '{0}/v1/describecomputeenvironments': BatchResponse.dispatch, + '{0}/v1/createcomputeenvironment$': BatchResponse.dispatch, + '{0}/v1/describecomputeenvironments$': BatchResponse.dispatch, }