Пример #1
0
        public HttpWebResponse ProcessRecord(HttpRequestRecord record, CookieCollection cookies)
        {
            HttpRequestClient client = new HttpRequestClient(record.Uri, record.RequestHeaders, cookies);

            NameValueCollection postData = record.PostData;

            foreach (string key in postData)
            {
                client.AddData(key, postData[key]);
            }

            if (record.Method == "POST")
            {
                if (record.ContentType == "application/json")
                {
                    return(client.PostJson(record.RequestContent));
                }

                return(client.PostUrlEncoded());
            }
            else
            {
                return(client.GetWebResponse());
            }
        }
Пример #2
0
 public HttpRequestProcessedResult(HttpRequestRecord httpRequestRecord, bool success, double elsapsedMilliSeconds, HttpStatusCode?httpResponseStatusCode, Exception exception = null, WebExceptionStatus?webExceptionStatus = null)
 {
     HttpRequestRecord      = httpRequestRecord;
     Success                = success;
     ElapsedMilliseconds    = elsapsedMilliSeconds;
     HttpResponseStatusCode = httpResponseStatusCode;
     Exception              = exception;
     ExceptionStatus        = webExceptionStatus;
 }
Пример #3
0
        public HttpRequestWorker(HttpRequestRecord record, int sleepTime, int firstRunDelay)
        {
            m_Record        = record;
            m_FirstRunDelay = firstRunDelay;
            m_HttpRequestRecordProcessor = new HttpRequestRecordProcessor();
            m_CookieCollection           = new CookieCollection();

            SucceessCount     = 0;
            FailCount         = 0;
            TotalCount        = 0;
            TotalMilliSeconds = 0;
            IsRunning         = false;
            SleepTime         = sleepTime;
        }
Пример #4
0
 public HttpRequestWorker(HttpRequestRecord record, int sleepTime)
     : this(record, sleepTime, 0)
 {
 }
Пример #5
0
 public HttpRequestWorker(HttpRequestRecord record)
     : this(record, 10)
 {
 }