Check if request type is json and throw exception if it is not.