Claus Ibsen created CAMEL-26263:
-----------------------------------

             Summary: camel-dapr - the secret operation always fails with No 
handler for operation secret, and the producer replaces all message headers
                 Key: CAMEL-26263
                 URL: https://issues.apache.org/jira/browse/CAMEL-26263
             Project: Camel
          Issue Type: Bug
          Components: camel-dapr
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of dapr (CAMEL-24961, PR #28409).

h4. 1. dapr:secret always fails

{{DaprOperationManager}} (main 2a465aa4814c, lines 34-40) registers a handler 
for every operation except {{secret}}, so every {{dapr:secret}} call fails with 
{{UnsupportedOperationException: No handler for operation secret}} (line 48). 
{{DaprSecretHandler}} exists, and its unit tests call it directly, so they 
pass. Checked on 4.24.0-SNAPSHOT with a Mockito {{DaprClient}} on the URI.

Proposed: register {{DaprSecretHandler}} for {{DaprOperation.secret}}, and add 
a test through the endpoint.

h4. 2. The producer replaces all message headers

{{DaprProducer.setResponse}} (line 48) calls 
{{setHeaders(response.getHeaders())}}, so every header set before the call is 
gone afterwards. Checked on 4.24.0-SNAPSHOT with the mock client.

Proposed: add the response headers to the existing ones 
({{getHeaders().putAll(...)}}).

h4. 3. A stream body fails, and a text body is sent as a JSON string

The handlers pass {{getIn().getBody()}} as it is to the {{DaprClient}} (e.g. 
{{DaprServiceInvocationHandler}}, line 42), whose Jackson serializer fails for 
an {{InputStream}} and sends a String as a JSON-quoted string ({{"hello"}} with 
the quotes). Checked on 4.24.0-SNAPSHOT with the mock client.

Proposed: convert stream and String bodies to byte[] (sent as is) before the 
call.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to