Skip to content

Commit 900ec56

Browse files
Reetika2509vaibhav0096
authored andcommitted
fix: Enhance response handling in request.yaml to include JSON unmarshalling
Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com>
1 parent 3bd44ea commit 900ec56

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

e2e-test/testdata/request.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ spec:
3737
response: {
3838
value: http.response.body
3939
isJSON: string.HasPrefix(http.response.body, "{") || string.HasPrefix(http.response.body, "[")
40+
// Only attempt to unmarshal if isJSON is true, and suppress all errors
4041
json: isJSON && json.Unmarshal(http.response.body) != _|_ ? json.Unmarshal(http.response.body) : _
4142
result: isJSON && json.Unmarshal(http.response.body) != _|_ ? json : value
43+
// Suppress marshal errors so step never fails
44+
_marshalErrorGuard: json.Unmarshal(http.response.body) | {}
4245
}
4346
parameter: {
4447
url: string

0 commit comments

Comments
 (0)