private bool HasHttpMethodWithBody(HttpMethodOptions httpMethod)
        {
            if (httpMethod == HttpMethodOptions.Get || httpMethod == HttpMethodOptions.Copy || httpMethod == HttpMethodOptions.Head || httpMethod == HttpMethodOptions.Purge || httpMethod == HttpMethodOptions.Unlock)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        private NetRequest CreateRequest(string baseUrl, string referer, HttpMethodOptions methodOptions)
        {
            var request = new NetRequest(baseUrl, methodOptions);

            request.AddParameter(HttpR.CookieKey, _execute12306cnInfo.Cookie, ParameterOptions.HttpHeader);
            request.AddParameter(HttpR.RefererKey, referer, ParameterOptions.HttpHeader);
            request.AddParameter(HttpR.UserAgentKey, HttpR.UserAgent, ParameterOptions.HttpHeader);
            request.AddParameter(HttpR.AcceptKey, HttpR.Accept, ParameterOptions.HttpHeader);
            request.AddParameter(HttpR.AcceptEncodingKey, HttpR.AcceptEncoding, ParameterOptions.HttpHeader);
            request.AddParameter(HttpR.AcceptLanguageKey, HttpR.AcceptLanguage, ParameterOptions.HttpHeader);
            request.AddParameter(HttpR.XRequestedWithKey, HttpR.XRequestedWith, ParameterOptions.HttpHeader);

            return(request);
        }
Exemplo n.º 3
0
 public NetRequest(Uri resource, HttpMethodOptions method) : this(resource.IsAbsoluteUri? resource.AbsolutePath + resource.Query: resource.OriginalString, method)
 {
 }
Exemplo n.º 4
0
 public NetRequest(string resource, HttpMethodOptions method) : this()
 {
     Resource = resource;
     Method   = method;
 }
Exemplo n.º 5
0
 public NetRequest(HttpMethodOptions method) : this()
 {
     Method = method;
 }