A GET request with a trailing ampersand (&) causes the mock server to return no data. If you paste the below tests into the end of MultipleTestsUsingTheSameStubServerAndDifferentUris.cs you can see the issue. It could be this is a kayak issue...
The spec is clear that this should be supported despite the url not being properly formatted.
// Should pass and does pass
[Test]
public void Should_get_with_parameters()
{
_httpMockRepository
.Stub(x => x.Get("/endpoint"))
.Return("I am a GET")
.OK();
AssertResponse("GET", "I am a GET", "/endpoint?a=b&c=d");
}
// Should pass but does not pass
[Test]
public void Should_get_with_parameters_and_trailing_ampersand()
{
_httpMockRepository
.Stub(x => x.Get("/endpoint"))
.Return("I am a GET")
.OK();
AssertResponse("GET", "I am a GET", "/endpoint?a=b&c=d&");
}
private void AssertResponse(string method, string expected, string uri)
{
var webRequest = (HttpWebRequest)WebRequest.Create("Http://localhost:8080"+uri);
webRequest.Method = method;
using (var response = webRequest.GetResponse())
{
using (var sr = new StreamReader(response.GetResponseStream()))
{
string readToEnd = sr.ReadToEnd();
Assert.That(readToEnd, Is.EqualTo(expected));
}
}
}
A GET request with a trailing ampersand (&) causes the mock server to return no data. If you paste the below tests into the end of MultipleTestsUsingTheSameStubServerAndDifferentUris.cs you can see the issue. It could be this is a kayak issue...
The spec is clear that this should be supported despite the url not being properly formatted.