Closed anymoreT closed 6 years ago
Our front-end team needs a server that can mock all requests.
I also have tried to compile the examples to a war, and deploy the war to tomcat. I think I don't understand how to use mockserver.
I think the main issue is with your instance of Tomcat, the HTML returned by Tomcat includes: The server understood the request but refuses to authorize it.
. This is a Tomcat authorisation error and not related to MockServer.
Your tomcat is preventing access to the deployed MockServer WAR.
You can not use one of the other mechanisms to run MockServer, as listed at: http://mock-server.com/mock_server/getting_started.html#start_mockserver
For example can you run MockServer from the command line, using the downloaded Jar, maven command or docker image?
thank you very much. I will try it .
import org.mockserver.client.server.MockServerClient; import static org.mockserver.model.HttpRequest.request; import static org.mockserver.model.HttpResponse.response;
public class MockServerClientExamples { public static void main (String[] args) { new MockServerClient("localhost", 1080) .when( request() .withMethod("GET") .withPath("/view") ) .respond( response() .withBody("+++++++testing!") ); } }
error:
while submitted expectation:
who can tell me how to use the war? My requirement is to create a mockserver that can provide some customized response from the outside.