Fix content type on errors

This will fix some edge cases in the behavior that was introduced in c14d0a288812c4b3885cf0de73b77649a56aa6ee, which causes errors to not always return the correct content-type. Fixes #182.