When you are writing REST web service tests, you can use the following code to read/write the HTTP headers:
SeS("REST_KB_Books").SetRequestHeader("Content-Type", "application/xml");
contentType = SeS("REST_KB_Books").GetRequestHeader("Content-Type");
Tester.Message(contentType); // prints "application/xml"
SeS("REST_KB_Books").DoExecute(); // xml response
SeS("REST_KB_Books").SetRequestHeader("Content-Type", "application/json");
contentType = SeS("REST_KB_Books").GetRequestHeader("Content-Type");
Tester.Message(contentType); // prints "application/json"
SeS("REST_KB_Books").DoExecute(); // json response
Another option that we recommend is using the new global Session object that was introduced in Rapise 5.0:
Session.SetRequestHeader("Content-Type", "application/xml");
headers = Session.GetRequestHeaders();
Tester.Message(JSON.stringify(headers)); // prints [{"Name":"Content-Type","Value":"application/xml"}]
SeS("REST_KB_Books").DoExecute(); // xml response
Session.SetRequestHeader("Content-Type", "application/json");
headers = Session.GetRequestHeaders();
Tester.Message(JSON.stringify(headers)); // prints [{"Name":"Content-Type","Value":"application/json"}]
SeS("REST_KB_Books").DoExecute(); // json response
Full working test is attached.