在C#中对HTTP请求进行单元测试我的代码名义上看起来像这样:stringbody=CreateHttpBody(regularExpression,strategy);HttpWebRequest请求=(HttpWebRequest)WebRequest.Create(_url);request.Method="POST";request.ContentType="text/plain;charset=utf-8";使用(StreamrequestStream=request.GetRequestStream()){requestStream.Write(Encoding.UTF8.GetBytes(body),0,body.Length);requestStream.Flush();}使用(HttpWebResponseresponse=(HttpWebResponse)request.GetResponse()){byte[]data=newbyte[response.ContentLength];使用(Streamstream=response.GetResponseStream()){intbytesRead=0;while(bytesRead
