Fix a few RPC corner cases and add tests

There were just a few corner-cases about the place which could cause an internal server error when they should instead work.
Yeah, it’s just so that it can isolate that particular `TypeError` from any other `TypeError` that might be raised. `{1:2}` is not legal for kwargs and is thus invalid user input and so should produce 400 rather than 500, while `raise TypeError` inside `func` should produce 500. That’s why I’d prefer not to go wrapping `self.execute(func, data)` with `except TypeError`.