[REST] basic input/output sanity check

Mentioned by SergioDemianLerner at https://github.com/bitcoin/bitcoin/commit/f676c80f437e15ab0ee190e93baea733a88db0f2#commitcomment-8996114