protected override async Task ProcessRequestAsync(IHttpWebRequest request, Dictionary <string, object> payload)
        {
            var formData = await request.WritePayloadFormToRequestAsync(payload)
                           .ConfigureAwait(false);

            if (CanMakeAuthenticatedRequest(payload))
            {
                request.AddHeader("Rest-Key", PublicApiKey.ToUnsecureString());
                var signKey = GetSignKey(request, formData);
                request.AddHeader("Rest-Sign", signKey);
            }
        }
Exemple #2
0
        protected override Task ProcessRequestAsync(IHttpWebRequest request, Dictionary <string, object> payload)
        {
            if (CanMakeAuthenticatedRequest(payload))
            {
                payload.Remove("nonce");
                var bodyPayload   = payload.Where(_ => _.Key.StartsWith("body.")).ToDictionary(_ => _.Key.Substring(5), _ => _.Value);
                var headerPayload = payload.Where(_ => !_.Key.StartsWith("body.")).ToDictionary(_ => _.Key, _ => _.Value);
                foreach (var item in headerPayload)
                {
                    request.AddHeader(item.Key, item.Value.ToString());
                }

                if (request.Method == "POST" && bodyPayload.Count() > 0)
                {
                    //var query = CryptoUtility.GetFormForPayload(bodyPayload);
                    var form = request.WritePayloadFormToRequestAsync(bodyPayload).Result;
                }
            }
            return(base.ProcessRequestAsync(request, payload));
        }