Skip to content

Add PATCH to HttpMethods enum for service invocation #1622

@lindner

Description

@lindner

Problem

The HttpMethods enum in DaprHttp does not include PATCH, which prevents using DaprClient.invokeMethod() with PATCH requests through HTTPEndpoints.

Use Case

When calling external REST APIs via Dapr HTTPEndpoint and service invocation, PATCH is commonly required for partial updates. For example, Salesforce REST API requires PATCH for updating records.

Current Workaround

Developers must bypass the SDK and make direct HTTP calls to the Dapr sidecar:

var url = "http://localhost:" + daprPort + "/v1.0/invoke/" + appId + "/method/" + path;
var request = HttpRequest.newBuilder()
    .uri(URI.create(url))
    .method("PATCH", BodyPublishers.ofString(body))
    .build();
httpClient.send(request, BodyHandlers.ofString());

This loses the benefits of the SDK (type safety, error handling, reactive patterns).

Proposed Solution

Add PATCH to the HttpMethods enum in DaprHttp.java:

public enum HttpMethods {
  NONE,
  GET,
  PUT,
  POST,
  DELETE,
  HEAD,
  CONNECT,
  OPTIONS,
  TRACE,
  PATCH  // Add this
}

Environment

  • Java SDK version: 1.12.0
  • Dapr runtime: 1.14.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions