Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Raw output can contain malformed HTTP status lines and body framing, misidentify the protocol version, and fail for custom model factories because it bypasses the byte-array conversion.
4 open issues
What changed in this PR
This PR addresses #1829 by adding HTTP call output selection, allowing workflows to access response headers and status alongside the body.
Changes:
- Routes
content,response, andrawoutput modes through the HTTP executor. - Extends response adapters and model factories to support full responses and binary output.
- Adds a workflow sample and integration test for response headers.
| File | Description |
|---|---|
impl/test/src/test/resources/workflows-samples/call-http-get-headers.yaml |
Adds a workflow using output: response. |
impl/test/src/test/java/org/openworkflow/sdk/impl/test/HTTPWorkflowDefinitionTest.java |
Tests response headers and body content. |
impl/model/src/main/java/org/openworkflow/sdk/impl/model/jackson/JacksonModelFactory.java |
Adds byte-array model conversion. |
impl/http/src/main/java/org/openworkflow/sdk/impl/jakarta/http/JakartaHttpResponse.java |
Exposes headers, content, and raw response output. |
impl/core/src/main/java/org/openworkflow/sdk/impl/WorkflowModelFactory.java |
Adds default Base64 conversion for byte arrays. |
impl/core/src/main/java/org/openworkflow/sdk/impl/http/WorkflowHttpResponse.java |
Expands the response interface for output modes. |
impl/core/src/main/java/org/openworkflow/sdk/impl/http/WorkflowHttpRequestHelper.java |
Implements output handlers and response serialization. |
impl/core/src/main/java/org/openworkflow/sdk/impl/http/DefaultHttpResponse.java |
Adapts the default client response to the expanded interface. |
impl/core/src/main/java/org/openworkflow/sdk/impl/executors/http/HttpExecutor.java |
Passes the selected output handler to request execution. |
impl/core/src/main/java/org/openworkflow/sdk/impl/executors/http/CallableTaskHttpExecutorBuilder.java |
Selects the handler from the HTTP output setting. |
impl/core/src/main/java/org/openworkflow/sdk/impl/auth/DigestAuthProvider.java |
Removes a cast after header access becomes string-typed. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The response and raw output modes bypass HTTP status validation, while raw serialization retains chunked-transfer headers without chunk framing, breaking error handling and producing invalid HTTP messages.
5 open issues
2 resolved since last review
Review effort: Balanced
e135133 to
0a29160
Compare
It also support http request & response additional content types Signed-off-by: Francisco Javier Tirado Sarti <ftirados@ibm.com>
970dab5 to
f54e8c0
Compare
…er name Signed-off-by: Francisco Javier Tirado Sarti <ftirados@ibm.com>
There was a problem hiding this comment.
🟡 Changes recommended
Binary responses can be corrupted by text decoding, while ignored charset declarations and overwritten request Content-Type headers can cause incorrect payload encoding and server-side parsing.
6 open issues
Encode request bodies using the declared charset · New Decode text responses using the declared charset · New Keep binary responses as bytes instead of decoding them as text · New Use lazy fallback to avoid redundant content-type inference · New Use locale-independent media-type normalization · New Preserve the request Content-Type when building the text entity · New
5 resolved since last review
Review effort: Balanced
| return HttpRequest.BodyPublishers.ofString( | ||
| body.asText() |
| } | ||
|
|
||
| private WorkflowModel textContent() { | ||
| return application.modelFactory().from(new String(response.body())); |
| } else { | ||
| return String.class; |
| return inferContentType(); | ||
| } | ||
| }) | ||
| .orElse(inferContentType()); |
| } | ||
| } | ||
| return null; | ||
| candidate = candidate.trim().toLowerCase(); |
| return Entity.text( | ||
| model | ||
| .asText() | ||
| .orElse("Workflow model should support asText for content type " + contentType)); |


Fix #1829