Fixed unwise error handling in Client.discover
Fixes #22 - clean up JSON middleware