Skip to content

Commit

Permalink
fix issue 2279
Browse files Browse the repository at this point in the history
  • Loading branch information
roseboy-liu committed Aug 21, 2024
1 parent 328a54d commit 48dc798
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions common/http_protocol/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ pub const PRIVATE_KEY: &str = "X-CnosDB-PrivateKey";

// value
pub const APPLICATION_PREFIX: &str = "application/";
pub const APPLICATION_CSV: &str = "application/csv";
pub const APPLICATION_TSV: &str = "application/tsv";
pub const APPLICATION_CSV: &str = "text/csv";
pub const APPLICATION_TSV: &str = "text/tsv";
pub const APPLICATION_JSON: &str = "application/json";
pub const APPLICATION_NDJSON: &str = "application/nd-json";
pub const APPLICATION_TABLE: &str = "application/table";
pub const APPLICATION_TABLE: &str = "text/table";
pub const APPLICATION_STAR: &str = "application/*";
pub const STAR_STAR: &str = "*/*";

Expand Down
12 changes: 6 additions & 6 deletions e2e_test/src/independent/https_api_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn test_v1_sql_path() {
let resp = check_response!(client.post(url, body));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// invalid basic auth
Expand All @@ -106,15 +106,15 @@ fn test_v1_sql_path() {
let resp = client.execute(req.build().unwrap()).unwrap();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);

// accept: application/csv
// accept: text/csv
let mut req = client.request_with_auth(Method::POST, url).body(body);
req = req.headers(headers! {
ACCEPT.as_str() => "application/csv"
ACCEPT.as_str() => "text/csv"
});
let resp = check_response!(client.execute(req.build().unwrap()));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// accept: application/json
Expand Down Expand Up @@ -147,7 +147,7 @@ fn test_v1_sql_path() {
let resp = check_response!(client.execute(req.build().unwrap()));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// accept: */*
Expand All @@ -158,7 +158,7 @@ fn test_v1_sql_path() {
let resp = check_response!(client.execute(req.build().unwrap()));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// accept: *
Expand Down
12 changes: 6 additions & 6 deletions e2e_test/src/reliant/http_api_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn test_v1_sql_path() {
let resp = check_response!(client.post(url, body));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// invalid basic auth
Expand All @@ -36,15 +36,15 @@ fn test_v1_sql_path() {
let resp = client.execute(req.build().unwrap()).unwrap();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);

// accept: application/csv
// accept: text/csv
let mut req = client.request_with_auth(Method::POST, url).body(body);
req = req.headers(headers! {
ACCEPT.as_str() => "application/csv"
ACCEPT.as_str() => "text/csv"
});
let resp = check_response!(client.execute(req.build().unwrap()));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// accept: application/json
Expand Down Expand Up @@ -77,7 +77,7 @@ fn test_v1_sql_path() {
let resp = check_response!(client.execute(req.build().unwrap()));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// accept: */*
Expand All @@ -88,7 +88,7 @@ fn test_v1_sql_path() {
let resp = check_response!(client.execute(req.build().unwrap()));
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
&HeaderValue::from_static("application/csv")
&HeaderValue::from_static("text/csv")
);

// accept: *
Expand Down
2 changes: 1 addition & 1 deletion query_server/sqllogicaltests/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fn build_http_request(
.request(Method::POST, url)
.basic_auth::<&str, &str>(option.username.as_str(), None)
.body(body)
.header(reqwest::header::ACCEPT, "application/csv")
.header(reqwest::header::ACCEPT, "text/csv")
.build()?;
Ok(request)
}
Expand Down

0 comments on commit 48dc798

Please sign in to comment.