Java Code Examples for okhttp3.mockwebserver.RecordedRequest#getMethod()

The following examples show how to use okhttp3.mockwebserver.RecordedRequest#getMethod() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CrudDispatcher.java    From mockwebserver with Apache License 2.0 6 votes vote down vote up
@Override
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
    String path = request.getPath();
    String method = request.getMethod();

    switch (method.toUpperCase()) {
        case POST:
        case PUT:
            return handleCreate(path, request.getBody().readUtf8());
        case PATCH:
            return handlePatch(path, request.getBody().readUtf8());
        case GET:
            return handleGet(path);
        case DELETE:
            return handleDelete(path);
        default:
            return null;
    }
}
 
Example 2
Source File: KubernetesCrudDispatcher.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
@Override
public MockResponse dispatch(RecordedRequest request) {
  String path = request.getPath();
  String method = request.getMethod();
  switch (method.toUpperCase()) {
    case POST:
      return handleCreate(path, request.getBody().readUtf8());
    case PUT:
      return handleReplace(path, request.getBody().readUtf8());
    case PATCH:
      return handlePatch(path, request.getBody().readUtf8());
    case GET:
      return detectWatchMode(path)? handleWatch(path): handleGet(path);
    case DELETE:
      return handleDelete(path);
    default:
      return null;
  }
}
 
Example 3
Source File: OpenShiftServiceImplTest.java    From syndesis with Apache License 2.0 4 votes vote down vote up
private static Request createFrom(RecordedRequest req) {
    return new Request(req.getMethod(), req.getPath(), req.getBody().readUtf8());
}