12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using Newtonsoft.Json;
- namespace AmrControl.Common.HttpClients
- {
- public class HttpDelete : BaseHttpClient
- {
- public HttpDelete(HttpClient httpClient, string baseUri) : base(httpClient, baseUri)
- {
- }
- protected override HttpMethod getMethod()
- {
- return HttpMethod.Delete;
- }
- protected override HttpContent? handleData<T>(T data)
- {
- return null;
- }
- protected override string reHandleUrl<T>(string url, T data)
- {
- string uri = base.reHandleUrl(url, data);
- if (data != null)
- {
- Dictionary<string, string> dict = convertObj2Dict<T>(data);
- //将参数放到url中
- foreach (var item in dict)
- {
- if (uri.IndexOf("?") > 0)
- {
- uri += "&" + item.Key + "=" + item.Value;
- }
- else
- {
- uri += "?" + item.Key + "=" + item.Value;
- }
- }
- }
- return uri;
- }
- }
- }
|