Skip to content

Commit 9e39cad

Browse files
committed
fix: describe REST HttpResponse result handling
Symptom: describe emitted `returns String` for REST call actions backed by ResultHandlingHttpResponse. Re-executing that MDL rebuilt the output variable as a string, so later `$Response/StatusCode` and `$Response/Content` expressions failed Mendix consistency checks. Root cause: the REST call formatter handled string, mapping, and none result handlers, but fell through to String for HttpResponse result handling. Fix: format ResultHandlingHttpResponse as `returns response`, matching the existing parser/builder syntax for full HTTP response variables. Tests: added a REST formatter regression that asserts HttpResponse result handling roundtrips as `returns response`.
1 parent 9db9930 commit 9e39cad

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

mdl/executor/cmd_microflows_format_action.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,8 @@ func formatRestCallAction(ctx *ExecContext, a *microflows.RestCallAction) string
922922
case *microflows.ResultHandlingString:
923923
sb.WriteString("String")
924924
_ = rh // used for type assertion only
925+
case *microflows.ResultHandlingHttpResponse:
926+
sb.WriteString("response")
925927
case *microflows.ResultHandlingMapping:
926928
sb.WriteString("mapping ")
927929
sb.WriteString(string(rh.MappingID))

mdl/executor/cmd_microflows_format_restcall_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ func TestFormatRestCallAction_GET(t *testing.T) {
3131
assertContains(t, got, "returns String")
3232
}
3333

34+
func TestFormatRestCallAction_HttpResponse(t *testing.T) {
35+
e := newTestExecutor()
36+
action := &microflows.RestCallAction{
37+
HttpConfiguration: &microflows.HttpConfiguration{
38+
HttpMethod: microflows.HttpMethodGet,
39+
LocationTemplate: "https://api.example.com/orders",
40+
},
41+
ResultHandling: &microflows.ResultHandlingHttpResponse{VariableName: "Response"},
42+
}
43+
got := e.formatRestCallAction(action)
44+
assertContains(t, got, "$Response = ")
45+
assertContains(t, got, "returns response")
46+
}
47+
3448
func TestFormatRestCallAction_POST_CustomBody(t *testing.T) {
3549
e := newTestExecutor()
3650
action := &microflows.RestCallAction{

0 commit comments

Comments
 (0)