private void CheckWebRequestStatusAndDispose(UnityWebRequest webRequest, MailChimpUser mailChimpUser, string errorMessage = "Web Request Error: ") { if (!string.IsNullOrEmpty(webRequest.error)) { Debug.LogError(errorMessage + "\n" + mailChimpUser.ToString() + webRequest.downloadHandler.text); } webRequest.Dispose(); }
public IEnumerator Subscribe(MailChimpUser mailChimpUser) { WWWForm form = mailChimpUser.AsForm(); form.AddField(formKey, ""); UnityWebRequest webRequest = UnityWebRequest.Post(formUrl, form); webRequest.chunkedTransfer = false; yield return(webRequest.SendWebRequest()); CheckWebRequestStatusAndDispose(webRequest, mailChimpUser, SignUpError); }