crossbell - v1.13.1
    Preparing search index...

    Function withHeaders

    • Attach headers to request headers from callback function.

      Note: This function does not work with multiple asynchronous operations by default. If you want to apply to multiple asynchronous operations, you need to call the ensure function before each asynchronous operation. (the first one doesn't need)

      Type Parameters

      • T

      Parameters

      • fn: (ensure: () => void) => T

        The callback function to request network.

      • headers: HeadersInit

        It will be attached to request headers from callback function.

      Returns T

      const result = withHeaders(() =>
      indexer.character.getMany(address),
      { 'X-My-Header': 'foo' }
      )