Skip to content

Commit

Permalink
Changed V5 POST content data from formdata to json
Browse files Browse the repository at this point in the history
  • Loading branch information
JKorf committed Aug 25, 2023
1 parent 3e8f311 commit f6f672f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ByBit.Net/BybitAuthenticationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Globalization;
using Bybit.Net.Clients.V5;
using System.Text;
using Newtonsoft.Json;

namespace Bybit.Net
{
Expand All @@ -33,7 +34,7 @@ public override void AuthenticateRequest(RestApiClient apiClient, Uri uri, HttpM
var timestamp = DateTimeConverter.ConvertToMilliseconds(GetTimestamp(apiClient).AddMilliseconds(-1000)).Value.ToString(CultureInfo.InvariantCulture);
if (apiClient is BybitRestClientCopyTradingApi || apiClient is BybitRestClientApi)
{
var signPayload = parameterPosition == HttpMethodParameterPosition.InUri ? uri.SetParameters(parameters, arraySerialization).Query.Replace("?", "") : parameters.ToFormData();
var signPayload = parameterPosition == HttpMethodParameterPosition.InUri ? uri.SetParameters(parameters, arraySerialization).Query.Replace("?", "") : apiClient.requestBodyFormat == RequestBodyFormat.FormData ? parameters.ToFormData() : JsonConvert.SerializeObject(parameters);
var key = _credentials.Key!.GetString();
var recvWindow = 5000;
var payload = timestamp + key + recvWindow + signPayload;
Expand Down
2 changes: 1 addition & 1 deletion ByBit.Net/Clients/V5/BybitRestClientApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal BybitRestClientApi(ILogger logger, HttpClient? httpClient, BybitRestOpt
ExchangeData = new BybitRestClientApiExchangeData(this);
Trading = new BybitRestClientApiTrading(this);

requestBodyFormat = RequestBodyFormat.FormData;
requestBodyFormat = RequestBodyFormat.Json;
ParameterPositions[HttpMethod.Delete] = HttpMethodParameterPosition.InUri;
}
#endregion
Expand Down

0 comments on commit f6f672f

Please sign in to comment.