How to use the @microsoft/microsoft-graph-client/lib/es/middleware/MiddlewareUtil.setRequestHeader 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 / utils / CustomHeaderMiddleware.ts View on Github external
public async execute(context: Context): Promise {
    if (this._getCustomHeaders) {
      const headers = await this._getCustomHeaders();
      for (const key in headers) {
        if (headers.hasOwnProperty(key)) {
          setRequestHeader(context.request, context.options, key, headers[key]);
        }
      }
    }
    return await this.nextMiddleware.execute(context);
  }
github microsoftgraph / microsoft-graph-toolkit / src / utils / SdkVersionMiddleware.ts View on Github external
public async execute(context: Context): Promise {
    try {
      let sdkVersionValue: string = `mgt/${PACKAGE_VERSION}`;

      sdkVersionValue += ', ' + getRequestHeader(context.request, context.options, 'SdkVersion');

      setRequestHeader(context.request, context.options, 'SdkVersion', sdkVersionValue);
      return await this.nextMiddleware.execute(context);
    } catch (error) {
      throw error;
    }
  }
  /**