2018-03-10 08:05:56 +00:00
|
|
|
|
using System.Net.Http;
|
2015-08-02 17:39:32 +00:00
|
|
|
|
using System.Text;
|
2018-03-10 08:05:56 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2015-08-02 17:39:32 +00:00
|
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
|
namespace Jackett.Common.Utils
|
2015-08-02 17:39:32 +00:00
|
|
|
|
{
|
2017-04-15 08:45:10 +00:00
|
|
|
|
public class JsonContent : StringContent
|
|
|
|
|
{
|
|
|
|
|
public JsonContent(object value)
|
|
|
|
|
: this(value, Encoding.UTF8)
|
|
|
|
|
{
|
|
|
|
|
Headers.ContentType.CharSet = "utf-8";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JsonContent(object value, Encoding encoding)
|
|
|
|
|
: base(JsonConvert.SerializeObject(value, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }), encoding, "application/json")
|
|
|
|
|
{
|
|
|
|
|
}
|
2015-08-02 17:39:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|