private IEnumerator PrepareRequest <T>(Response <T> response)
        {
            yield return(new WaitForSeconds(0.05f)); // wait 5ms so that headers etc can be set

            IEnumerable <KeyValuePair <string, IEnumerable <string> > > h = requestHeaders;

            if (form != null)
            {
                h = requestHeaders.AddRangeViaUnion(form.headers.Map(ToHeader));
                request.uploadHandler = new UploadHandlerRaw(form.data);
            }
            request.SetRequestHeaders(h);
            yield return(request.SendWebRequestV2(response));
        }
Beispiel #2
0
        private IEnumerator PrepareRequest <T>(Response <T> response)
        {
            yield return(waitForRequestToBeConfigured.Task.WithTimeout(30000).AsCoroutine());

            IEnumerable <KeyValuePair <string, IEnumerable <string> > > h = requestHeaders;

            if (form != null)
            {
                h = requestHeaders.AddRangeViaUnion(form.headers.Map(ToHeader));
                request.uploadHandler = new UploadHandlerRaw(form.data);
            }
            if (streamToSend != null)
            {
                if (form != null)
                {
                    throw new DataMisalignedException("Cant have both a form and a stream as the request content");
                }
                request.uploadHandler = new UploadHandlerRaw(streamToSend.ToByteArray());
            }
            request.SetRequestHeaders(h);
            yield return(request.SendWebRequestV2(response));
        }