|
@@ -20,8 +20,15 @@ public class HotlineClient : IHotlineClient, IDisposable
|
|
TRequest request, CancellationToken cancellationToken)
|
|
TRequest request, CancellationToken cancellationToken)
|
|
where TRequest : class
|
|
where TRequest : class
|
|
{
|
|
{
|
|
- var req = new RestRequest(path, httpMethod)
|
|
|
|
- .AddJsonBody(request);
|
|
|
|
|
|
+ var req = new RestRequest(path, httpMethod);
|
|
|
|
+ if (httpMethod is Method.Get)
|
|
|
|
+ {
|
|
|
|
+ req.AddObject(request);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ req.AddJsonBody(request);
|
|
|
|
+ }
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -39,11 +46,18 @@ public class HotlineClient : IHotlineClient, IDisposable
|
|
}
|
|
}
|
|
|
|
|
|
public async Task<ApiResponse> ExecuteAsync<TRequest>(string path, Method httpMethod, TRequest request,
|
|
public async Task<ApiResponse> ExecuteAsync<TRequest>(string path, Method httpMethod, TRequest request,
|
|
- CancellationToken cancellationToken)
|
|
|
|
|
|
+ CancellationToken cancellationToken)
|
|
where TRequest : class
|
|
where TRequest : class
|
|
{
|
|
{
|
|
- var req = new RestRequest(path, httpMethod)
|
|
|
|
- .AddJsonBody(request);
|
|
|
|
|
|
+ var req = new RestRequest(path, httpMethod);
|
|
|
|
+ if (httpMethod is Method.Get)
|
|
|
|
+ {
|
|
|
|
+ req.AddObject(request);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ req.AddJsonBody(request);
|
|
|
|
+ }
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|