Fixes #2026

Added check to see if array key for content type is set.
Merge pull request #2027 from vimishor/bug/2026

Fixes #2026