add content-length header and error handling while asking statusCode