Pre request script is not added in the code


in Postman i configured a POST request and i adding a pre request Script. It works.
I want to get the javascript code of this configuration to use the javascript code in another software.

Postman provides the following javascript code:

function test3(){

var myHeaders = new Headers();
myHeaders.append(“Content-Type”, “application/xml”);
myHeaders.append(“Authorization”, “Basic SDYyNDIxOTpJTklUMTI=”);

var raw = "<?xml version=\"1.0\" encoding=\"utf-8\"?><entry xml:base=“” xmlns=“” xmlns:m=“” xmlns:d=“”><content type=“application/xml”><m:properties><d:ID>1268535</d:ID>

var requestOptions = {
method: ‘POST’,
headers: myHeaders,
body: raw,
redirect: ‘follow’
fetch(“”, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log(‘error’, error));


you can see, Authorisation , cookie and content-type are added to the header, but the pre request Script content is not.

I muss add the pre request Script content to this java script code, else the logic is not working properly.

i tried:
myHeaders.append(“PreRequest”, “test code test code test code”);
but it doesnt work.

How can i add the pre Request content to the header?
Any suggestions?

Thank you

The code inside the Pre-request Scripts and Tests sandbox is only known to Postman and used only in that context so it wouldn’t be part of the code snippet, as the selected language wouldn’t know how to execute it.