Fixes #4: check for valid content-type first