public void TestUser() { RequestSplit testUser = new RequestSplit(); StringBuilder req = new StringBuilder(); req.Append( "GET /message HTTP/1.1\n" + "Host: localhost:8080\n" + "User-Agent: insomnia/2020.4.2\n" + "Content-Type: text/plain\n" + "Accept: */*\n" + "Content-Length: 0\n" + ""); testUser.split(req.ToString()); Assert.AreEqual("insomnia/2020.4.2", testUser.RequestBody["User-Agent"]); }
public void TestContentLength() { RequestSplit testClp = new RequestSplit(); StringBuilder req = new StringBuilder(); req.Append( "POST /message HTTP/1.1\n" + "Host: localhost:8080\n" + "User-Agent: insomnia/2020.4.2\n" + "Content-Type: text/plain\n" + "Accept: */*\n" + "Content-Length: 10\n" + "\n" + "My Message" + ""); testClp.split(req.ToString()); Assert.AreEqual(10, testClp.ContentLength); }