Closed Tset-Noitamotua closed 4 years ago
If it's separated test cases, you can change ROBOT_LIBRARY_SCOPE to TEST CASE. It will clear all each tests and you need to reset again.
@Tset-Noitamotua: Could you post a practical use case where you need to remove headers?
Yes, ROBOT_LIBRARY_SCOPE
is Test Suite. Thus, you can reset headers, and get rid of what you don't need to use in further tests, by organising your test cases in test suites according to this.
Clever. That's right.
@DoanhPoPu that's a really good idea. But as @asyrjasalo says RESTinstance uses TEST SUITE
scope. And there is no way to change ROBOT_LIBRARY_SCOPE
during import of REST library yet. That means one would have to patch RESTinstance library code to use this solution.
Here is related text in RF User Guide: Test library scope
Thus it would be really cool to have a possibility to change library scope during import. Like this:
*** Settings ***
Library REST scope=TEST CASE
# OR
Library REST library_scope=TEST CASE
On the other hand such solution (while it is good) would be some what implicit while a keyword like Unset Headers
or an option like Set Headers clear=True
would be more explicit.
related issue: #82
Yeah, it's true what you say regarding having a separate keyword - but it's unneeded when as a bonus (with some more effort) you get your test cases organised well in addition.
This is what I want people to look forward into. As I see it's for their best.
Hi Anssi (@asyrjasalo), may we reopen this one? I run into this issue once again. And even if I agree with you last comment I think sometimes it's good to have some additional option :-)
🙏
As the
Set Headers
keyword always adds items to a request header it would be handy to have a keyword to either remove single items from header or completely unset the headers. I am aware of theheaders=
option of keywords likeGet
,Post
, etc. but this overrides given header items only.What if I want to remove/deactivate a single header item?
Example
headers={"If-Match": null}
a valid way to remove this item form header?What is the best way to clear headers completely?
headers={}
doesn't help?