Simulate Incorrect Content-Length Headers for HTTP in C#

Posted by cfeduke on Stack Overflow See other posts from Stack Overflow or by cfeduke
Published on 2009-08-25T16:15:24Z Indexed on 2010/05/23 14:20 UTC
Read the original article Hit count: 324

We are building a comprehensive integration test framework in C# for our application which exists on top of HTTP using IIS7 to host our applications.

As part of our integration tests we want to test incoming requests which will result in EndOfStreamExceptions ("Unable to read beyond end of stream") that occur when a client sends up a HTTP header indicating a larger body size than it actually transmits as part of the body. We want to test our error recovery code for this condition so we need to simulate these sorts of requests.

I am looking for a .NET Fx-based socket library or custom HttpWebRequest replacement that specifically allows developers to simulate such conditions to add to our integration test suite. Does anyone know of any such libraries? A scriptable solution would work as well.

© Stack Overflow or respective owner

Related posts about c#

Related posts about httpwebrequest