title: nestjs configure https.agent
body: <p>Hi I've tried to use nestJs framework to build a simple application.
  This application call a http service to retrive and log some informations. I attach the code of nestjs service:</p>
  <pre><code>import { HttpService, Injectable, Logger } from '@nestjs/common';
  import { ConfigService } from '@nestjs/config';
  import { UserInformation } from 'src/models/userInformation';
  import https from 'https';
  @Injectable()
      export class CallService {
        private authRequest: any;
        private httpsAgent: https.Agent;
      
        constructor(
          private configService: ConfigService,
          private httpService: HttpService,
        ) {
          this.httpsAgent = new https.Agent({
            rejectUnauthorized: false,
          });
          this.authRequest = {
            username: configService.get('username'),
            password: configService.get('password'),
          };
        }
      
        getUserInformation(): Promise&lt;UserInformation&gt; {
          var url = this.configService.get('apiEndpoint') + 'scrapt/getUserInfo';
      
          return this.httpService
            .get(url, {
              auth: this.authRequest,
              httpsAgent: this.httpsAgent,
            })
            .toPromise()
            .then((response) =&gt; {
              return new UserInformation(response.data);
            });
        }
      
        }
  </code></pre>
  <p>when the</p>
  <blockquote>
  <p>getUserInformation</p>
  </blockquote>
  <p>function is trigger in console appear this error:</p>
  <blockquote>
  <p>'Cannot read property 'Agent' of undefined'</p>
  </blockquote>
  <p>it is ref on line:</p>
  <pre><code> this.httpsAgent = new https.Agent({
  </code></pre>
  <p>I tried to search some information on internet but I did not found anything have we any idea how resolve it?</p>