Added defensive code for media type resolution when server does not send the header.
Fixes #12