sahaya / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

It is incredibly hard to remove a header in a Filter #384

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to implement a RemoveHeaderFilter class

What is the expected output? What do you see instead?
The only way to remove a header is to copy the whole collection of headers, 
filter out the one you don't want, and then set all headers again with 
headers(Headers) or headers(Map<String, ?>).

What version of the product are you using? On what operating system?
Version: 2.4.0
OS: OS X

Please provide any additional information below.
N/A

Original issue reported on code.google.com by kna...@gmail.com on 11 Feb 2015 at 3:42

GoogleCodeExporter commented 9 years ago
Actually, I don't think the code I wrote even works. It looks like headers can 
only be added and never removed?? This makes Filters much less powerful and 
RequestSpecification much less composable.

Original comment by kna...@gmail.com on 12 Feb 2015 at 7:08

GoogleCodeExporter commented 9 years ago
This means I can't even modify an existing header—instead, another copy of 
the existing header gets added.

Original comment by kna...@gmail.com on 12 Feb 2015 at 7:11

GoogleCodeExporter commented 9 years ago
One last comment: This functionality does exist in JerseyTest's 
ClientRequestFilter and spring-test's RestTemplate.

Original comment by kna...@gmail.com on 12 Feb 2015 at 7:19

GoogleCodeExporter commented 9 years ago
Nevermind about modifying headers! I found overwriteHeadersWithName. The 
original issue still stands, though.

Original comment by kna...@gmail.com on 12 Feb 2015 at 7:28

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 12 Feb 2015 at 6:35