added mimeType to response handle of the messages and error handling