Scripted REST APIs

aswinsiddaling2
Kilo Guru

Hi,

I have created a scripted REST API where I am fetching the HTTP headers by using the below function

request.getHeader('header name').

But I want to fetch all the headers that we receive in the request. I tried to use request.headers as suggested in docs but it gives me [object Object]

Any suggestions?

1 ACCEPTED SOLUTION

Please try this, You should convert the Json to string



var header = request.headers;


var json = new JSON();


var headerStr = json.encode(header);


gs.log(headerStr);



Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

10 REPLIES 10

Thank You



Thanks


PS: Hit like, Helpful or Correct depending on the impact of the response