internal IEnumerator Start()

in Facebook.Unity/Utils/AsyncRequestString.cs [83:145]


        internal IEnumerator Start()
        {
            UnityWebRequestAsyncOperation webRequestOperation;
            if (this.method == HttpMethod.GET)
            {
                string urlParams = this.url.AbsoluteUri.Contains("?") ? "&" : "?";
                if (this.formData != null)
                {
                    foreach (KeyValuePair<string, string> pair in this.formData)
                    {
                        urlParams += string.Format("{0}={1}&", Uri.EscapeDataString(pair.Key), Uri.EscapeDataString(pair.Value));
                    }
                }

                UnityWebRequest webRequest = UnityWebRequest.Get(url + urlParams);
                if (Constants.CurrentPlatform != FacebookUnityPlatform.WebGL)
                {
                    webRequest.SetRequestHeader("User-Agent", Constants.GraphApiUserAgent);
                }

                webRequestOperation = webRequest.SendWebRequest();
            }
            else
            {
                // POST or DELETE
                if (this.query == null)
                {
                    this.query = new WWWForm();
                }

                if (this.method == HttpMethod.DELETE)
                {
                    this.query.AddField("method", "delete");
                }

                if (this.formData != null)
                {
                    foreach (KeyValuePair<string, string> pair in this.formData)
                    {
                        this.query.AddField(pair.Key, pair.Value);
                    }
                }

                if (Constants.CurrentPlatform != FacebookUnityPlatform.WebGL)
                {
                    this.query.headers["User-Agent"] = Constants.GraphApiUserAgent;
                }

                UnityWebRequest webRequest = UnityWebRequest.Post(url.AbsoluteUri, query);
                webRequestOperation = webRequest.SendWebRequest();
            }

            yield return webRequestOperation;

            if (this.callback != null)
            {
                this.callback(new GraphResult(webRequestOperation));
            }

            // after the callback is called,  web request should be able to be disposed
            webRequestOperation.webRequest.Dispose();
            MonoBehaviour.Destroy(this);
        }