@Test
  public void testIsUploadRequest() throws Exception {
    List<String> operations = Utils.getStaticFieldValuesAsStrings(Operations.class).collect(Collectors.toList());
    RestMethod[] methods = RestMethod.values();

    for (String operation : operations) {
      for (RestMethod method : methods) {
        JSONObject header = new JSONObject();
        header.put(RestUtils.InternalKeys.REQUEST_PATH,
            RequestPath.parse("/" + operation, Collections.emptyMap(), Collections.emptyList(), "ambry-test"));
        RestRequest request = createRestRequest(method, "/" + operation, header);
        boolean isUpload = RestUtils.isUploadRequest(request);
        assertEquals(operation.equals(Operations.NAMED_BLOB) && method == RestMethod.PUT, isUpload);
      }
    }
    // One exception for PUT named blob
    {
      JSONObject header = new JSONObject();
      header.put(RestUtils.InternalKeys.REQUEST_PATH,
          RequestPath.parse("/" + Operations.NAMED_BLOB, Collections.emptyMap(), Collections.emptyList(),
              "ambry-test"));
      header.put(RestUtils.Headers.UPLOAD_NAMED_BLOB_MODE, "STITCH");
      RestRequest request = createRestRequest(RestMethod.PUT, "/" + Operations.NAMED_BLOB, header);
      assertFalse(RestUtils.isUploadRequest(request));
    }

    for (RestMethod method : methods) {
      JSONObject header = new JSONObject();
      header.put(RestUtils.InternalKeys.REQUEST_PATH,
          RequestPath.parse("/", Collections.emptyMap(), Collections.emptyList(), "ambry-test"));
      RestRequest request = createRestRequest(method, "/", header);
      boolean isUpload = RestUtils.isUploadRequest(request);
      assertEquals(method == RestMethod.POST, isUpload);
    }
  }
Test request is upload request.
@throws Exception
ambry-api/src/test/java/com/github/ambry/rest/RestUtilsTest.java