public void CreateRequest() { var transport = new BasicHttpTransport(); var request = transport.CreateRequest(new Uri("http://klarna.com")); Assert.That(request, Is.TypeOf<HttpWebRequest>()); Assert.That(request.AllowAutoRedirect, Is.False); Assert.That(request.Timeout, Is.EqualTo(5000)); }
public void HeaderNameCaseInsensitive() { var transport = new BasicHttpTransport(); var uri = new Uri("http://httpbin.org/status/200"); var request = transport.CreateRequest(uri); request.Method = "GET"; var response = transport.Send(request, string.Empty); var expected = response.Header("Content-Type"); var lowerCase = response.Header("content-type"); Assert.That(lowerCase, Is.EqualTo(expected)); var mixedCase = response.Header("cOnTeNt-TyPe"); Assert.That(mixedCase, Is.EqualTo(expected)); }
public void SendReturningErrorCode(int code) { var transport = new BasicHttpTransport(); var uri = string.Format("http://httpbin.org/status/{0}", code); var request = transport.CreateRequest(new Uri(uri)); request.Method = "GET"; var response = transport.Send(request, string.Empty); Assert.That((int)response.StatusCode, Is.EqualTo(code)); }
public void Timeout() { var transport = new BasicHttpTransport(); Assert.That(transport.Timeout, Is.EqualTo(5000)); transport.Timeout = 10000; Assert.That(transport.Timeout, Is.EqualTo(10000)); }