コード例 #1
0
        public void ReadResponseSplit()
        {
            var client     = (IHttpWorkerClient) new FakeHttpWorkerClient("HTTP/1.1 200 OK\r\nDate: Wed, 06 Jul 2016 18:26:27 GMT\r\nContent-Length: 13\r\nContent-Type: text/plain\r\nServer: Kestrel\r\n\r\n", "Hello, World!");
            var httpWorker = new HttpWorker(client, new Uri("http://netling.test", UriKind.Absolute), null);  //TODO: Headers

            var(length, statusCode) = httpWorker.Send();
            Assert.AreEqual(200, statusCode);
            Assert.AreEqual(132, length);
        }
コード例 #2
0
        public ValueTask DoWork()
        {
            _localStopwatch.Restart();
            var(length, statusCode) = _httpWorker.Send();

            if (statusCode < 400)
            {
                _workerThreadResult.Add((int)_stopwatch.ElapsedMilliseconds / 1000, length, (float)_localStopwatch.ElapsedTicks / Stopwatch.Frequency * 1000, statusCode, _index < 10);
            }
            else
            {
                _workerThreadResult.AddError((int)_stopwatch.ElapsedMilliseconds / 1000, (float)_localStopwatch.ElapsedTicks / Stopwatch.Frequency * 1000, statusCode, _index < 10);
            }

            return(new ValueTask());
        }