Handle case where "Content-Type" header is not set

Avoids "Cannot read property 'match' of null" exceptions.
See first commit in this PR