mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-25 22:29:58 +00:00
Compare commits
1 Commits
python-v0.
...
rpgreen/no
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e340599c1f |
@@ -108,7 +108,10 @@ describe("remote connection", () => {
|
|||||||
it("should pass on requested extra headers", async () => {
|
it("should pass on requested extra headers", async () => {
|
||||||
await withMockDatabase(
|
await withMockDatabase(
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
expect(req.headers["x-my-header"]).toEqual("my-value");
|
expect(req.headers["foo"]).toEqual("1");
|
||||||
|
expect(req.headers["bar"]).toEqual("2");
|
||||||
|
expect(req.headers["baz"]).toEqual("3");
|
||||||
|
expect(req.headers["x-log-attrs"]).toEqual("foo, bar, baz");
|
||||||
|
|
||||||
const body = JSON.stringify({ tables: [] });
|
const body = JSON.stringify({ tables: [] });
|
||||||
res.writeHead(200, { "Content-Type": "application/json" }).end(body);
|
res.writeHead(200, { "Content-Type": "application/json" }).end(body);
|
||||||
@@ -119,9 +122,12 @@ describe("remote connection", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
clientConfig: {
|
clientConfig: {
|
||||||
extraHeaders: {
|
extraHeaders: {
|
||||||
"x-my-header": "my-value",
|
"x-log-attrs": "foo, bar, baz",
|
||||||
},
|
foo: "1",
|
||||||
|
bar: "2",
|
||||||
|
baz: "3",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright The LanceDB Authors
|
// SPDX-FileCopyrightText: Copyright The LanceDB Authors
|
||||||
|
|
||||||
use http::HeaderName;
|
use http::HeaderName;
|
||||||
use log::debug;
|
use log::{debug, info};
|
||||||
use reqwest::{
|
use reqwest::{
|
||||||
header::{HeaderMap, HeaderValue},
|
header::{HeaderMap, HeaderValue},
|
||||||
Body, Request, RequestBuilder, Response,
|
Body, Request, RequestBuilder, Response,
|
||||||
@@ -324,6 +324,7 @@ impl<S: HttpSend> RestfulLanceDbClient<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (key, value) in &config.extra_headers {
|
for (key, value) in &config.extra_headers {
|
||||||
|
info!("header: {}={}", key, value);
|
||||||
let key_parsed = HeaderName::from_str(key).map_err(|_| Error::InvalidInput {
|
let key_parsed = HeaderName::from_str(key).map_err(|_| Error::InvalidInput {
|
||||||
message: format!("non-ascii value for header '{}' provided", key),
|
message: format!("non-ascii value for header '{}' provided", key),
|
||||||
})?;
|
})?;
|
||||||
|
|||||||
Reference in New Issue
Block a user