Skip to content

Commit

Permalink
Fixed JSON no parameters issue and added a 'noargs' method to the tes…
Browse files Browse the repository at this point in the history
…t handler.

git-svn-id: http://tornadorpc.googlecode.com/svn/trunk@9 6a0cc88c-bc38-11de-9a73-11f8458f6c97
  • Loading branch information
catchjosh committed Sep 13, 2010
1 parent 3da9f51 commit 170098a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tornadorpc/base.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ def add(self, x, y):


def ping(self, x): def ping(self, x):
return x return x

def noargs(self):
return 'Works!'


tree = TestMethodTree() tree = TestMethodTree()


Expand Down
8 changes: 5 additions & 3 deletions tornadorpc/json.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ def parse_request(self, request_body):
if isbatch(request): if isbatch(request):
self._batch = True self._batch = True
for req in request: for req in request:
req_tuple = (req['method'], req['params']) req_tuple = (req['method'], req.get('params', []))
request_list.append(req_tuple) request_list.append(req_tuple)
else: else:
self._requests = [request,] self._requests = [request,]
request_list.append((request['method'], request['params'])) request_list.append(
(request['method'], request.get('params', []))
)
return tuple(request_list) return tuple(request_list)


def parse_responses(self, responses): def parse_responses(self, responses):
Expand Down

0 comments on commit 170098a

Please sign in to comment.