AssemblyCSharp.BackendConnection.DoPostData C# (CSharp) Method

DoPostData() public method

public DoPostData ( string path, string postDataBody, CancellationToken cancellationToken, bool verifyResponse, object>.Action responseCallback = null ) : IEnumerator
path string
postDataBody string
cancellationToken CancellationToken
verifyResponse bool
responseCallback object>.Action
return IEnumerator
        public IEnumerator DoPostData(string path, string postDataBody, CancellationToken cancellationToken, bool verifyResponse, Action<Dictionary<string, object>> responseCallback = null)
        {
            if (IsCanceled)
            {
            return Enumerable.Empty<object>().GetEnumerator();
            }
            else
            {
            PSDebug.Log("Performing Request: {0}, {1}", path, postDataBody);
            if (responseCallback == null)
            {
                responseCallback = DevNullCallback;
            }

            var headers = CreateRequestHeaders(path, postDataBody);
            headers["Content-Type"] = "application/json";

            var www = new WWW(AbsURL(path), Encoding.UTF8.GetBytes(postDataBody), headers);

            return DoRequest(www, cancellationToken, verifyResponse, responseCallback);
            }
        }

Usage Example

Ejemplo n.º 1
0
 protected override IEnumerator DoExecuteCoroutine(TaskExecutionContext context, BackendConnection connection)
 {
     PSDebug.Log("Execute BackendUpdateTask");
     yield return connection.DoPostData(
     connection.UserAction("update"),
     _serializedGameState,
     context.CancellationToken,
     false
     );
 }