Adding requests data to headers

I´m trying to add the requests data to the headers. besides some other variables which work propper, trying to add the requests data results in a “Could not get any response” error.

Here´s what I do:

Pre-request Script:

var body =;
if(_.isEmpty(body)) body = “”;
postman.setEnvironmentVariable(‘mybody’, body);


X-Body {{mybody}}

Can one explain why the error occures? I´ll do the same with some other variables without any problems. adding the one for request data leads to the error.

It is highly unusual to send a “body” using a header.

While there is not limitation when it comes to the HTTP protocol, the server may reject your value because it is too long.
Have you tried with a shorter value?

Thanks for the reply!

I agree that this is unusual, and it´s for debugging only. I used it already successfull, but only with empty strings (""), which worked well for me.

Lately die postman console gave me the hint (View -> Show Postman Console) that there are unprocessable characters in my provided body (it was a short json). Without linebreaks and tabs I could send the data in the header.

But as you already mentioned, this was not for production rather than for debugging and lately it solved my problem.

Thanks for the help anyways!