for one of the custom headers, I need to set it to an empty value. Somehow I am not able to.
I tried setting it to “”, " ", ‘’, ’ ',``, , null, undefined but still I don’t think it’s working.
To give a reference in RobotFrameworks, there is a defined value called {EMPTY}, when I set header to this empty value it works through robot frameworks.
I believe passing the empty string should work. To prove that, you can try the option --http-debug, which can enable logging of all HTTP requests and responses. For example, if I run something like:
Thanks for the response. When I set it to opening and closing quotes, the --http-debug flag doesn’t show it but I print the response object which prints the headers used to send the particular request where header is shown like this {“BId”:[“”]}, where as I expect it to be {“BId” : [ ]}
The thing is that the headers are just key/value pairs of the strings. And the typical way to pass multiply values is comma-separated value, like:
X-HEADER: ab,cd,wx,yz
So, interpreting the value as the array is the responsibility of the server-side. If your serverside is expecting to constantly parse value like [] in the header, you can try this:
http.get('http://127.0.0.1:8085/', {
headers: {
"header_empty": "[]", // it's a string
"header_filled": ["one", "two"], // this will be converted to a CSV
"header_filled_the_other_way": "[\"one\", \"two\"]", // it's a string again
}
});