diff --git a/src/Nancy.Tests/Unit/RequestFixture.cs b/src/Nancy.Tests/Unit/RequestFixture.cs index d0e90dc413..fa6b24d417 100644 --- a/src/Nancy.Tests/Unit/RequestFixture.cs +++ b/src/Nancy.Tests/Unit/RequestFixture.cs @@ -146,6 +146,30 @@ public void Should_set_extract_form_data_from_body_when_content_type_is_x_www_fo memory.Position = 0; var headers = + new Dictionary> + { + { "content-type", new[] { "application/x-www-form-urlencoded" } } + }; + + // When + var request = new Request("POST", "/", headers, memory, "http"); + + // Then + ((string)request.Form.name).ShouldEqual("John Doe"); + } + + [Fact] + public void Should_set_extract_form_data_from_body_when_content_type_is_x_www_form_urlencoded_with_character_set() + { + // Given + const string bodyContent = "name=John+Doe&gender=male&family=5&city=kent&city=miami&other=abc%0D%0Adef&nickname=J%26D"; + var memory = CreateRequestStream(); + var writer = new StreamWriter(memory); + writer.Write(bodyContent); + writer.Flush(); + memory.Position = 0; + + var headers = new Dictionary> { { "content-type", new[] { "application/x-www-form-urlencoded; charset=UTF-8" } }