2020-02-09 02:35:16 +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)
|
2020-02-25 16:08:03 +00:00
|
|
|
: this(value, Encoding.UTF8) =>
|
2017-04-15 08:45:10 +00:00
|
|
|
Headers.ContentType.CharSet = "utf-8";
|
|
|
|
|
|
|
|
public JsonContent(object value, Encoding encoding)
|
2020-02-25 16:08:03 +00:00
|
|
|
: base(
|
|
|
|
JsonConvert.SerializeObject(
|
|
|
|
value, Formatting.Indented, new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore}),
|
|
|
|
encoding, "application/json")
|
2017-04-15 08:45:10 +00:00
|
|
|
{
|
|
|
|
}
|
2015-08-02 17:39:32 +00:00
|
|
|
}
|
|
|
|
}
|