You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your documentation [https://github.com/square/okhttp/tree/master/mockwebserver] says that in 4.12.0 you can do:
final Dispatcher dispatcher = new Dispatcher() {
@Override
public MockResponse dispatch (RecordedRequest request) throws InterruptedException {
switch (request.getPath()) {
case "/v1/login/auth/":
return new MockResponse().setResponseCode(200);
case "/v1/check/version/":
return new MockResponse().setResponseCode(200).setBody("version=9");
case "/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);
Yet it is impossible since Dispatcher class is final in OKHttp 4.12.0
The text was updated successfully, but these errors were encountered:
OK, sorry, disregard, Dispatcher here was imported (autoimport in intelij) from okhttp3.Dispatcher, and should be from okhttp3.mockwebserver.Dispatcher - as the doc says. Sorry, closing.
Your documentation [https://github.com/square/okhttp/tree/master/mockwebserver] says that in 4.12.0 you can do:
final Dispatcher dispatcher = new Dispatcher() {
};
server.setDispatcher(dispatcher);
Yet it is impossible since Dispatcher class is final in OKHttp 4.12.0
The text was updated successfully, but these errors were encountered: