Using pm.sendRequest with NTLM authentication

Hi,

I’m new to pm.sendRequest and need some help with how to add NTLM authentication to the request headers

Here is what I have so far:

var EndPoint = pm.environment.get(“SoapEndpoint”)`;

const echoPostRequest = {
  url: EndPoint,
  method: 'POST',
  header: {
      'Content-Type':'text/xml',
      'SoapAction':pm.globals.get("SoapAction"),
  },
  
   body: {
    mode: 'raw',
    raw: pm.globals.get("GetXML")
  }
 };

pm.sendRequest(echoPostRequest, function (err, res) {
console.log(err ? err : res);
});

I have a UserName, Password and Domain in the Authentication tab of my request. Can I reference those if I execute pm.sendRequest in pre request of test or do I have to manually specify here too.

if I have to manually specify where/how do I do it?. Do I have to tell it to do NTLM authentication?

Thanks
Ryan

Hey @RyanHowardTest, pm.sendRequest works with any valid Postman request structure, so you can use NTLM auth as follows:

pm.sendRequest({
  url: EndPoint,
  header: {
      'Content-Type': 'text/xml',
      SoapAction: pm.globals.get('SoapAction')
  },
  method: 'POST',
  auth: {
    type: 'ntlm',
    ntlm: {
      username: 'uname',
      password: 'pass',
      domain: 'domain',
      workstation: 'workstation'
   }
 },
 body: {
    mode: 'raw',
    raw: pm.globals.get('GetXML')
  }
});

it works with GET requests? because i’m trying but without success…