Skip to content
Advertisement

How to verify if a node in response body has unique value with postman?

The following is the response body of an API:

JavaScript

In Postman Tests, how to verify if exercise_num node in the response body above is unique?

Advertisement

Answer

Filter out unique exercise_num values and compare the length of the actual array and unique value array. Where you can use Array#reduce method for filtering unique values.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement