Skip to content

Can not use {{BaseURL}} in contains() function when use dsl matcher #5666

Closed Answered by dwisiswant0
lnlinh31 asked this question in Q&A
Discussion options

You must be logged in to vote

You don’t actually need to use {{ and }} for variable substitution when writing within the DSL. The {{}} format is mainly used in template request definitions, but in DSL expressions, the vars are directly accessible.

Here’s a simple workaround:

Instead of writing it like how you originally did, you can try: status_code == 302 && !contains(header, 'Location: ' + BaseURL + '/login/google')

This format should properly substitute the BaseURL var and make your condition function correctly.

Alternatively, you could also leverage the concat helper func, which allows you to concatenate literal strings & variables. Example: !contains(header, concat('Location: ', BaseURL, '/login/google'))

This sh…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dwisiswant0
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
2 participants
Converted from issue

This discussion was converted from issue #5663 on September 25, 2024 01:50.