Skip to content

Commit 4245763

Browse files
committed
[Fix #984] Fixing node response type
Signed-off-by: fjtirado <[email protected]>
1 parent be3f29f commit 4245763

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,17 @@ private static RequestSupplier buildRequestSupplier(
187187
switch (method.toUpperCase()) {
188188
case HttpMethod.POST:
189189
WorkflowFilter bodyFilter = WorkflowUtils.buildWorkflowFilter(application, body);
190-
return (request, w, context, node) ->
191-
converter.toModel(
192-
application.modelFactory(),
193-
node,
194-
request.post(
195-
converter.toEntity(bodyFilter.apply(w, context, node)), node.objectClass()));
190+
return (request, w, context, node) -> {
191+
WorkflowModel model = bodyFilter.apply(w, context, node);
192+
return converter.toModel(
193+
application.modelFactory(),
194+
node,
195+
request.post(converter.toEntity(model), model.objectClass()));
196+
};
196197
case HttpMethod.GET:
197198
default:
198199
return (request, w, t, n) ->
199-
converter.toModel(application.modelFactory(), n, request.get(n.objectClass()));
200+
converter.toModel(application.modelFactory(), n, request.get(Object.class));
200201
}
201202
}
202203

impl/test/src/test/java/io/serverlessworkflow/impl/test/HTTPWorkflowDefinitionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ private static Stream<Arguments> provideParameters() {
106106
"workflows-samples/call-http-endpoint-interpolation.yaml", petInput, petCondition),
107107
Arguments.of(
108108
"workflows-samples/call-http-query-parameters.yaml", starTrekInput, starTrekCondition),
109+
Arguments.of(
110+
"workflows-samples/callFindByStatusHttp.yaml", Map.of(), new Condition<WorkflowModel>(
111+
o -> !o.asCollection().isEmpty(), "HasElementCondition")),
109112
Arguments.of(
110113
"workflows-samples/call-http-query-parameters-external-schema.yaml",
111114
starTrekInput,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
document:
2+
dsl: 1.0.0-alpha1
3+
namespace: test
4+
name: http-call-find-by-status
5+
version: 1.0.0
6+
do:
7+
- tryGetPet:
8+
try:
9+
- getPet:
10+
call: http
11+
with:
12+
headers:
13+
content-type: application/json
14+
method: get
15+
endpoint:
16+
uri: https://petstore.swagger.io/v2/pet/findByStatus?status=sold
17+
catch:
18+
errors:
19+
with:
20+
type: https://serverlessworkflow.io/spec/1.0.0/errors/communication
21+
status: 404

0 commit comments

Comments
 (0)