don't strip request body if we don't recognize the request method (#294)

* don't strip request body if we don't recognize the request method

* use IsNullOrEmpty
This commit is contained in:
Eli Bishop
2019-07-03 09:15:17 -07:00
committed by Stef Heyenrath
parent 55a0a6ee71
commit 06576ab317
3 changed files with 108 additions and 2 deletions

View File

@@ -125,5 +125,28 @@ Content-Type: text/html
Check.That(body.DetectedBodyType).IsEqualTo(detectedBodyType);
Check.That(body.DetectedBodyTypeFromContentType).IsEqualTo(detectedBodyTypeFromContentType);
}
[Theory]
[InlineData("HEAD", false)]
[InlineData("GET", false)]
[InlineData("PUT", true)]
[InlineData("POST", true)]
[InlineData("DELETE", false)]
[InlineData("TRACE", false)]
[InlineData("OPTIONS", true)]
[InlineData("CONNECT", false)]
[InlineData("PATCH", true)]
public void BodyParser_ShouldParseBody_ExpectedResultForKnownMethods(string method, bool resultShouldBe)
{
Check.That(BodyParser.ShouldParseBody(method)).Equals(resultShouldBe);
}
[Theory]
[InlineData("REPORT")]
[InlineData("SOME-UNKNOWN-METHOD")]
public void BodyParser_ShouldParseBody_DefaultIsTrueForUnknownMethods(string method)
{
Check.That(BodyParser.ShouldParseBody(method)).IsTrue();
}
}
}