ITADN

Add PATCH to HttpMethods enum for service invocation

#1622Closedlindner 创建于 2026-01-20
L
lindnercommented
## 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: ```java 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`: ```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
关闭于 2026-02-02 0 条评论