forked from DropNet/DropNetRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpRequest.cs
More file actions
28 lines (24 loc) · 758 Bytes
/
Copy pathHttpRequest.cs
File metadata and controls
28 lines (24 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
namespace DropNetRT.HttpHelpers
{
public class HttpRequest : HttpRequestMessage
{
public List<HttpParameter> Parameters { get; set; }
public HttpRequest(HttpMethod httpMethod, string requestUrl)
: base(httpMethod, requestUrl)
{
Parameters = new List<HttpParameter>();
}
public void AddParameter(string name, object value)
{
Parameters.Add(new HttpParameter(name, value));
}
public void AddBody(object obj)
{
Content = new StringContent(JsonConvert.SerializeObject(obj), Encoding.UTF8, "application/json");
}
}
}