Closed codeplayer14 closed 5 years ago
After your start code, can you try to add this code?
System.Console.WriteLine("Press any key to stop the server");
System.Console.ReadKey();
fms.Stop();
I tried. Same result. I was using a while(true) loop before to block the thread from exiting. Replaced it with your code. But the result is still the same.
Note that when you start the server like this, a random port is used. If you want to fix the port, use:
FluentMockServer fms = FluentMockServer.Start("http://localhost:9999");
or
FluentMockServer fms = FluentMockServer.Start(9999);
Yeah. But that's not the issue I'm facing. I've been getting the port from fms.Ports and using it in the request. However, I don't get a response.
You are sending a POST request ?
(Can you also export the Postman request so that I can re-play this on my machine?)
Yes I'm using a POST request. Attaching the Postman request.
I'm using this code (tested in Linqpad):
FluentMockServer fms = FluentMockServer.Start(9999);
fms.Given(
Request.Create().WithPath("/api/evaluator/start").UsingPost())
.RespondWith(Response.Create().WithBody("hello").WithStatusCode(202)
);
Thread.Sleep(1000*1000);
fms.Stop();
And Postman works fine:
Okay. Thanks. Turns out I was missing one of the dependencies! :/
I'm using the following code
On hitting this with Postman or Fiddler I get no response. The server is started as mentioned below. I also face the same issue when I start it with Admin interface and try to access one of the admin routes. From the Immediate Window, this is the status of the fms variable