private static IEnumerator UploadToAsync(string url, byte[] data, ResultCallback callback, string contentType)
        {
            var uploadRequest = HttpRequestBuilder.CreatePut(url)
                                .WithContentType(contentType)
                                .WithBody(System.Convert.ToBase64String(data))
                                .Accepts(MediaType.ApplicationJson)
                                .GetResult();

            IHttpResponse response = null;

            yield return(AccelByteNetUtilities.HttpClient.SendRequest(uploadRequest, rsp => response = rsp));

            var result = response.TryParse();

            callback.Try(result);
        }
예제 #2
0
        public static IEnumerator Put <T, R>(this IHttpClient client, string url, T body, ResultCallback <R> callback)
        {
            IHttpRequest request = HttpRequestBuilder.CreatePut(url).WithBearerAuth().WithJsonBody(body).GetResult();

            return(client?.SendRequest(request, HttpClientExtension.CreateResponseHandler(callback)));
        }