Webhook Response Header Expression

Hi there, it it possible to ad logic to a response header in a web hook? And if so, how?

I would like to check if there’s a variable and if not provide a default value, so

{{$json["filename"]? $json["filename"] :"default"}}

Thanks in advance.

1 Like

From looking at your other thread it seems you have already figured out this part :wink:

You could also use an even shorter variant of this:

{{$json["filename"] || "default"}}

This uses JavaScript’s short-circuiting logic for the OR operator (||). If $json["filename"] already returns a truthy value, the part after the || isn’t evaluated. But if $json["filename"] returns something falsy (for example because no filename was provided by the previous node), "default" is returned.

1 Like