Bert
|
1e41232f28
|
Node SDK Client middleware for HTTP Requests (#1130)
Adds client-side middleware to LanceDB Node SDK to instrument HTTP
Requests
Example - adding `x-request-id` request header:
```js
class HttpMiddleware {
constructor({ requestId }) {
this.requestId = requestId
}
onRemoteRequest(req, next) {
req.headers['x-request-id'] = this.requestId
return next(req)
}
}
const db = await lancedb.connect({
uri: 'db://remote-123',
apiKey: 'sk_...',
})
let tables = await db.withMiddleware(new HttpMiddleware({ requestId: '123' })).tableNames();
```
---------
Co-authored-by: Weston Pace <weston.pace@gmail.com>
|
2024-04-05 16:33:37 -07:00 |
|