protected IEnumerator SendInternal(Request request) { if (BaseURI == null) { request.Fail(); Log(new HTTP.Exception(HTTP.Exception.Type.NotConfigured, request.ToString())); yield break; } #if !UNITY_EDITOR if (!IsConnectedToInternet) { request.Fail(); Log(new HTTP.Exception(HTTP.Exception.Type.NoInternetAccess, request.ToString())); yield break; } #endif UriBuilder builder = new UriBuilder(BaseURI); builder.Path = request.Action.ToLower(); string url = builder.ToString(); WWW www; if (request.Parameters != null) { WWWForm form = new WWWForm(); foreach (KeyValuePair <string, string> pair in request.Parameters) { form.AddField(pair.Key, pair.Value); } www = new WWW(url, form); } else { www = new WWW(url); } yield return(www); if (www.error == null) { Reply reply = new Reply(www.bytes); request.Succeed(reply); Log("Sent/Received", "Request: " + request.ToString() + "\n" + "Reply: " + reply.ToString()); } else { request.Fail(); Log(new HTTP.Exception(HTTP.Exception.Type.CouldNotSend, www.error + "\n" + request.ToString())); } }