using Apewer; using Apewer.Models; using Apewer.Network; using System; using System.Collections.Generic; using System.Collections.Specialized; namespace Apewer.Web { /// [Serializable] public sealed class ApiRequest { private Json _data = null; #if NETFX internal System.Web.HttpContext Context { get; set; } #endif #if NETCORE internal Microsoft.AspNetCore.Http.HttpContext Context { get; set; } #endif /// 客户端 IP 地址。 public string IP { get; set; } #region 请求头。 /// public Uri Url { get; set; } /// public Uri Referrer { get; set; } /// HTTP 头中的 User Agent 字符串。 public string UserAgent { get; set; } /// HTTP 方法。 public HttpMethod Method { get; set; } /// 已解码的 URL 参数。 public StringPairs Parameters { get; set; } = new StringPairs(); /// HTTP 头。 public StringPairs Headers { get; set; } = new StringPairs(); /// Cookies。 public StringPairs Cookies { get; set; } = new StringPairs(); #endregion #region API 请求。 /// public string Application { get; set; } /// public string Function { get; set; } /// public string Random { get; set; } /// public string Ticket { get; set; } /// public string Session { get; set; } /// public string Page { get; set; } #endregion #region POST 内容。 /// public byte[] PostData { get; set; } /// public string PostText { get; set; } /// public Json PostJson { get; set; } /// public Json Data { get { if (_data == null) _data = Json.NewObject(); return _data; } set { _data = value; } } #endregion } }