mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-27 15:12:53 +00:00
## Summary This PR introduces a `HeaderProvider` which is called for all remote HTTP calls to get the latest headers to inject. This is useful for features like adding the latest auth tokens where the header provider can auto-refresh tokens internally and each request always set the refreshed token. --------- Co-authored-by: Claude <noreply@anthropic.com>
1.4 KiB
1.4 KiB
@lancedb/lancedb • Docs
@lancedb/lancedb / StaticHeaderProvider
Class: StaticHeaderProvider
Example implementation: A simple header provider that returns static headers.
This is an example implementation showing how to create a HeaderProvider for cases where headers don't change during the session.
Example
const provider = new StaticHeaderProvider({
authorization: "Bearer my-token",
"X-Custom-Header": "custom-value"
});
const headers = provider.getHeaders();
// Returns: {authorization: 'Bearer my-token', 'X-Custom-Header': 'custom-value'}
Extends
Constructors
new StaticHeaderProvider()
new StaticHeaderProvider(headers): StaticHeaderProvider
Initialize with static headers.
Parameters
- headers:
Record<string,string> Headers to return for every request.
Returns
Overrides
Methods
getHeaders()
getHeaders(): Record<string, string>
Return the static headers.
Returns
Record<string, string>
Copy of the static headers.