microshed-testing
microshed-testing copied to clipboard
add cookies/headers to the RESTClient decorator
I have a lot of tests that use the RESTClient decorator.
Due to some security concerns, now we need to exchange a session cookie. This cookie must remain the same between requests on some operations.
It would be nice if we can use something like
RESTClient(headers = {header1, header2}) public static MyService myService;
I know it is possible to use the RestClientBuilder, but I do prefer the decorator approach!
hi @a-simoes, thanks for raising this idea. Are the headers you need to add static/final strings? Keep in mind that annotation values must be constants. If you generate the header values at runtime, or even if they have to be created by a function, then they cannot be used in annotation attributes because they are not constant values.
Hi @aguibert . I understand that only static/final strings could be added and not runtime values. That is completely ok. For this particular case, it will work perfectly.
@a-simoes are you still interested in this enhancement? Have you considered using RestAssured to overcome this issue?
nop. I ended up creating a custom REST client.