mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-09 00:46:19 +00:00
Made parameter logging use actually json data for post requests
This commit is contained in:
parent
0229405775
commit
74d3f692b9
@ -14,6 +14,7 @@ namespace CryptoExchange.Net.Interfaces
|
||||
void SetProxy(string host, int port);
|
||||
|
||||
string ContentType { get; set; }
|
||||
string Content { get; set; }
|
||||
string Accept { get; set; }
|
||||
long ContentLength { get; set; }
|
||||
|
||||
|
@ -26,6 +26,8 @@ namespace CryptoExchange.Net.Requests
|
||||
set => request.ContentType = value;
|
||||
}
|
||||
|
||||
public string Content { get; set; }
|
||||
|
||||
public string Accept
|
||||
{
|
||||
get => ((HttpWebRequest)request).Accept;
|
||||
|
@ -145,16 +145,9 @@ namespace CryptoExchange.Net
|
||||
log.Write(LogVerbosity.Debug, $"Request {uri.AbsolutePath} was limited by {limitResult.Data}ms by {limiter.GetType().Name}");
|
||||
}
|
||||
|
||||
string paramString = null;
|
||||
if (parameters != null)
|
||||
{
|
||||
paramString = "with parameters";
|
||||
|
||||
foreach (var param in parameters)
|
||||
paramString += $" {param.Key}={(param.Value.GetType().IsArray ? $"[{string.Join(", ", ((object[])param.Value).Select(p => p.ToString()))}]": param.Value )},";
|
||||
|
||||
paramString = paramString.Trim(',');
|
||||
}
|
||||
string paramString = null;
|
||||
if (parameters != null && method == Constants.PostMethod)
|
||||
paramString = "with request body " + request.Content;
|
||||
|
||||
log.Write(LogVerbosity.Debug, $"Sending {method}{(signed ? " signed" : "")} request to {request.Uri} {paramString ?? ""}");
|
||||
var result = await ExecuteRequest(request).ConfigureAwait(false);
|
||||
@ -233,7 +226,7 @@ namespace CryptoExchange.Net
|
||||
{
|
||||
var data = Encoding.UTF8.GetBytes(stringData);
|
||||
request.ContentLength = data.Length;
|
||||
|
||||
request.Content = stringData;
|
||||
using (var stream = request.GetRequestStream().Result)
|
||||
stream.Write(data, 0, data.Length);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user