Browse Source

new FormRestRequest used for sending form data in url encoded format.

pull/1806/head
emorell96 4 years ago
parent
commit
05717cf93e
1 changed files with 22 additions and 0 deletions
  1. +22
    -0
      src/Discord.Net.Rest/Net/Queue/Requests/FormRestRequest.cs

+ 22
- 0
src/Discord.Net.Rest/Net/Queue/Requests/FormRestRequest.cs View File

@@ -0,0 +1,22 @@
using Discord.Net.Rest;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Discord.Net.Queue
{
public class FormRestRequest : RestRequest
{
public IEnumerable<KeyValuePair<string?, string?>> FormData { get; }

public FormRestRequest(IRestClient client, string method, string endpoint, IEnumerable<KeyValuePair<string?, string?>> formData, RequestOptions options)
: base(client, method, endpoint, options)
{
FormData = formData;
}

public override async Task<RestResponse> SendAsync()
{
return await Client.SendAsync(Method, Endpoint, FormData, Options.CancelToken, Options.HeaderOnly, Options.AuditLogReason).ConfigureAwait(false);
}
}
}

Loading…
Cancel
Save