Add json response checker Handle http errors Change connectDialog to casDialog (for better understanding)