perhaps due to my inexperience with rest-assured and hamcrest matchers I haven't managed to figure out how to do this assertion properly
when().
get(url).
then().
header("my-header", lessThanOrEqualTo("60")); // should compare Integers not Strings
An obvious solution would be to extract the value from header, convert it to Integer and then do the assertion manually. However that would kinda spoil the beauty of working with rest-assured. Is there a way to do the correct comparison without bloating the test?
As of REST Assured 2.6.0 you can supply a mapping function as the second argument to the
header
method. For example you can make use of Java 8 method references like this: