restContext.getRequestHeaders();
I am passing HashMap of type HashMap(String,String) to request Header as shown in the abstract code.
var headers=restContext.getRequestHeaders();
for( key in headers){
query.replace(''#id#'',headers[key]);
query= query.concat(headers[key]);
}