Skip to content

Commit 8293512

Browse files
committed
fix inconsistency in csv component: "separator", not "delimiter" #608 (comment)
1 parent 99f0a00 commit 8293512

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/render.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,11 @@ impl CsvBodyRenderer {
473473
options: &JsonValue,
474474
) -> anyhow::Result<CsvBodyRenderer> {
475475
let mut builder = csv_async::AsyncWriterBuilder::new();
476-
if let Some(delimiter) = get_object_str(options, "delimiter") {
477-
let &[delimiter_byte] = delimiter.as_bytes() else {
478-
bail!("Invalid csv delimiter: {delimiter:?}. It must be a single byte.");
476+
if let Some(separator) = get_object_str(options, "separator") {
477+
let &[separator_byte] = separator.as_bytes() else {
478+
bail!("Invalid csv separator: {separator:?}. It must be a single byte.");
479479
};
480-
builder.delimiter(delimiter_byte);
480+
builder.delimiter(separator_byte);
481481
}
482482
if let Some(quote) = get_object_str(options, "quote") {
483483
let &[quote_byte] = quote.as_bytes() else {

tests/csv_data.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
select 'csv' as component;
1+
select 'csv' as component, ';' as separator;
22
select 0 as id, 'Hello World 😊!' as msg
33
union all
44
select 1 as id, 'Goodbye World 😔!' as msg;

tests/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ async fn test_csv_body() -> actix_web::Result<()> {
270270
);
271271
let body = test::read_body(resp).await;
272272
let body_str = String::from_utf8(body.to_vec()).unwrap();
273-
assert_eq!(body_str, "id,msg\n0,Hello World 😊!\n1,Goodbye World 😔!\n");
273+
assert_eq!(body_str, "id;msg\n0;Hello World 😊!\n1;Goodbye World 😔!\n");
274274
Ok(())
275275
}
276276

0 commit comments

Comments
 (0)