Skip to content

Any way to do partial response match #1369

Answered by jcamiel
chenrui333 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @chenrui333,

Generally, you can simply use matches and contains predicates with a body query, for instance:

GET https://api.foo.com

HTTP 200
[Asserts]
body contains "bar"                       # simple contains
body matches /[a-z]{4}-\d{8}/             # wether we have a match or not
body regex /([a-z]{4})-\d{8}/ == "abcd"   # more precise than `matches`, we can test the value of a captured group
regex /([a-z]{4})-\d{8}/ == "abcd"        # equivalent than previous but sorter

Do you have use case that you can share so we can see how to address it?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chenrui333
Comment options

Answer selected by chenrui333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants