added error check for http.NewRequest