Improve the exeption management
Parse header and body content