Compare commits

...

1 Commits

Author SHA1 Message Date
Ryan Green
e340599c1f test to reproduce node extra headers issue 2025-08-04 10:03:04 -02:30
2 changed files with 12 additions and 5 deletions

View File

@@ -108,7 +108,10 @@ describe("remote connection", () => {
it("should pass on requested extra headers", async () => {
await withMockDatabase(
(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: [] });
res.writeHead(200, { "Content-Type": "application/json" }).end(body);
@@ -119,9 +122,12 @@ describe("remote connection", () => {
},
{
clientConfig: {
extraHeaders: {
"x-my-header": "my-value",
},
extraHeaders: {
"x-log-attrs": "foo, bar, baz",
foo: "1",
bar: "2",
baz: "3",
},
},
},
);

View File

@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright The LanceDB Authors
use http::HeaderName;
use log::debug;
use log::{debug, info};
use reqwest::{
header::{HeaderMap, HeaderValue},
Body, Request, RequestBuilder, Response,
@@ -324,6 +324,7 @@ impl<S: HttpSend> RestfulLanceDbClient<S> {
}
for (key, value) in &config.extra_headers {
info!("header: {}={}", key, value);
let key_parsed = HeaderName::from_str(key).map_err(|_| Error::InvalidInput {
message: format!("non-ascii value for header '{}' provided", key),
})?;