Skip to content

Instantly share code, notes, and snippets.

@aykuttasil
Created March 1, 2019 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aykuttasil/fc8e49413b7d5cc4e8857102796cea0e to your computer and use it in GitHub Desktop.
Save aykuttasil/fc8e49413b7d5cc4e8857102796cea0e to your computer and use it in GitHub Desktop.
final Dispatcher dispatcher = new Dispatcher() {
@Override
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
if (request.getPath().equals("/v1/login/auth/")){
return new MockResponse().setResponseCode(200);
} else if (request.getPath().equals("v1/check/version/")){
return new MockResponse().setResponseCode(200).setBody("version=9");
} else if (request.getPath().equals("/v1/profile/info")) {
return new MockResponse().setResponseCode(200).setBody("{\\\"info\\\":{\\\"name\":\"Lucas Albuquerque\",\"age\":\"21\",\"gender\":\"male\"}}");
}
return new MockResponse().setResponseCode(404);
}
};
server.setDispatcher(dispatcher);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment