Improve content type detection

Added a check to ensure the proper content-type is sent. I didn't have any issues with grove but I did with the same code on other projects. No issues after applying this fix (so far...)