How to use the @microsoft/microsoft-graph-client.HTTPMessageHandler function in @microsoft/microsoft-graph-client

To help you get started, we’ve selected a few @microsoft/microsoft-graph-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoftgraph / microsoft-graph-toolkit / src / Graph.ts View on Github external
constructor(provider: IProvider) {
    if (provider) {
      const authenticationHandler = new AuthenticationHandler(provider);
      const retryHandler = new RetryHandler(new RetryHandlerOptions());
      const telemetryHandler = new TelemetryHandler();
      const sdkVersionMiddleware = new SdkVersionMiddleware();
      const httpMessageHandler = new HTTPMessageHandler();

      authenticationHandler.setNext(retryHandler);
      retryHandler.setNext(telemetryHandler);
      telemetryHandler.setNext(sdkVersionMiddleware);
      sdkVersionMiddleware.setNext(httpMessageHandler);

      this.client = Client.initWithMiddleware({
        middleware: authenticationHandler
      });
    }
  }