Force input stream binary encoding

This fixes #11 where fakeweb returns non-binary encoding.
I've also replaced a clunky if/else with a more elegant case statement.