Skip to content

Commit 381d088

Browse files
authored
Add nil validation of reference type to dsl.Body (#3579)
1 parent 9ae1ae0 commit 381d088

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dsl/http.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,10 @@ func Body(args ...any) {
948948
)
949949
switch a := args[0].(type) {
950950
case string:
951+
if ref == nil {
952+
eval.ReportError("Body is set but %s is not defined", kind)
953+
return
954+
}
951955
if !expr.IsObject(ref.Type) {
952956
eval.ReportError("%s type must be an object with an attribute with name %#v, got %T", kind, a, ref.Type)
953957
return

0 commit comments

Comments
 (0)