Possibility to unregister filters ?

104 views
Skip to first unread message

Frédéric Camblor

unread,
May 21, 2012, 2:24:33 PM5/21/12
to rest-a...@googlegroups.com
Hi everyone !

I'm trying to play with rest assured filters, and I'm wondering if there is a possibility to unregister previously registered filters ?

My use case : I created a JUnit rule allowing to keep sessionId from REST requests inside a unit test execution.
Problem is : I don't want to enable this behaviour on every of my test cases (in some tests, I want to open several differentiated sessions, thus, I don't add the JUnit rule on these tests), so, I need to "clean the campfire as it was before my rule execution".
To be able to clean the campfire, I should remove my added filter after each test execution.

But I don't see any API allowing to do this (RestAssured.filters() returns an UnmodifiableList).
Shouldn't we add a RestAssured.removeFilters(List<Filter> filters) method to do this ?

WDYT ?

Frédéric Camblor  
Bordeaux JUG Board member
Jenkins community member & plugin commiter


Johan Haleby

unread,
May 22, 2012, 2:15:18 AM5/22/12
to rest-a...@googlegroups.com
Hi, 

There are already some methods for doing this. You can use "given().noFilters().." to remove all filters and "given().noFiltersOfType(SomeFilterType.class).." to remove a specific filter. But I'm not sure they'll work in your case if you've defined your filters statically. In that case we'll need to add an extra method just as you say. I'll add it as an issue.

Regards,
/Johan
Reply all
Reply to author
Forward
0 new messages