-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTianResponse.cs
50 lines (47 loc) · 1.53 KB
/
TianResponse.cs
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using Newtonsoft.Json;
using System.Net;
using System.Net.Http.Headers;
namespace TianYanCha.SDK
{
public abstract class TianResponse
{
/// <summary>
/// 设置或获取响应的内容
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public string ResponseBody { set; get; }
/// <summary>
/// 设置或获取HttpStatusCode
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public HttpStatusCode StatusCode { set; get; }
/// <summary>
/// 设置或获取请求地址
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public string RequestUri { set; get; }
/// <summary>
/// 设置或获取请求内容
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public string RequestBody { set; get; }
/// <summary>
/// 设置或获取响应头
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public HttpResponseHeaders Headers { set; get; }
public override string ToString()
{
var headers = Headers?.ToString();
return $"{this.GetType().Name}" +
$"{System.Environment.NewLine}" +
$"{headers}" +
$"{System.Environment.NewLine}" +
$"{RequestUri}:{StatusCode}" +
$"{System.Environment.NewLine}" +
$"Request:{RequestBody}" +
$"{System.Environment.NewLine}" +
$"Response:{ResponseBody}";
}
}
}