Skip to content

Commit b12c792

Browse files
committed
refactor(databases): drop redundant upload content-type param
1 parent 73d53b8 commit b12c792

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

src/databases.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ fn finish_upload(
334334
// `size` becomes the `Content-Length` so the server fast-fails an oversized
335335
// upload before writing bytes; the `--url` source may not know it, hence
336336
// `Option`. Carries the same auth + scope headers as every other SDK call.
337-
let result = api.upload_stream(reader, size, "application/octet-stream");
337+
let result = api.upload_stream(reader, size);
338338
pb.finish_and_clear();
339339

340340
match result {

src/sdk.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -578,19 +578,22 @@ impl Api {
578578
/// [`reader_into_stream`]. `content_length`, when known, is sent as
579579
/// `Content-Length` so the server can reject an oversized upload up front
580580
/// (the `--url` path may not know the length, hence `Option`).
581+
///
582+
/// The `Content-Type` is left to the SDK default (`application/octet-stream`):
583+
/// the managed-table load keys off the parquet file extension, not the
584+
/// upload's recorded content type.
581585
pub fn upload_stream(
582586
&self,
583587
reader: impl std::io::Read + Send + 'static,
584588
content_length: Option<u64>,
585-
content_type: &str,
586589
) -> Result<String, ApiError> {
587590
let mut cfg = self.client.configuration().clone();
588591
cfg.client = upload_reqwest_client();
589592
let upload_client = Client::from_configuration(cfg);
590593

591594
let stream = reader_into_stream(reader);
592595
let resp = rt()
593-
.block_on(upload_client.upload_stream(stream, Some(content_type), content_length))
596+
.block_on(upload_client.upload_stream(stream, None, content_length))
594597
.map_err(ApiError::from_sdk)?;
595598
Ok(resp.id)
596599
}
@@ -1350,11 +1353,7 @@ mod tests {
13501353

13511354
let api = Api::test_new(&server.url(), "test-jwt", Some("ws-1"));
13521355
let id = api
1353-
.upload_stream(
1354-
std::io::Cursor::new(payload),
1355-
Some(len as u64),
1356-
"application/octet-stream",
1357-
)
1356+
.upload_stream(std::io::Cursor::new(payload), Some(len as u64))
13581357
.expect("sized upload should succeed");
13591358

13601359
assert_eq!(id, "upload_sized");
@@ -1382,11 +1381,7 @@ mod tests {
13821381

13831382
let api = Api::test_new(&server.url(), "test-jwt", Some("ws-1"));
13841383
let id = api
1385-
.upload_stream(
1386-
std::io::Cursor::new(payload),
1387-
None,
1388-
"application/octet-stream",
1389-
)
1384+
.upload_stream(std::io::Cursor::new(payload), None)
13901385
.expect("chunked upload should succeed");
13911386

13921387
assert_eq!(id, "upload_chunked");
@@ -1411,11 +1406,7 @@ mod tests {
14111406

14121407
let api = Api::test_new(&server.url(), "test-jwt", Some("ws-1"));
14131408
let err = api
1414-
.upload_stream(
1415-
std::io::Cursor::new(payload),
1416-
Some(len as u64),
1417-
"application/octet-stream",
1418-
)
1409+
.upload_stream(std::io::Cursor::new(payload), Some(len as u64))
14191410
.expect_err("a 400 should map to an error");
14201411

14211412
match err {

0 commit comments

Comments
 (0)