fix: add missing content type in headers for `influxdb2_client` (#6021)
* fix: add missing content-type to buckets * fix: add missing content-type to label * fix: add missing content-type to setuppull/24376/head
parent
643fd58e02
commit
7f8d58e21a
|
@ -16,6 +16,7 @@ impl Client {
|
|||
|
||||
let response = self
|
||||
.request(Method::POST, &create_bucket_url)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(
|
||||
serde_json::to_string(&post_bucket_request.unwrap_or_default())
|
||||
.context(SerializingSnafu)?,
|
||||
|
@ -47,6 +48,7 @@ mod tests {
|
|||
|
||||
let mock_server = mock("POST", "/api/v2/buckets")
|
||||
.match_header("Authorization", format!("Token {}", token).as_str())
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(
|
||||
format!(
|
||||
r#"{{"orgID":"{}","name":"{}","retentionRules":[]}}"#,
|
||||
|
|
|
@ -73,6 +73,7 @@ impl Client {
|
|||
};
|
||||
let response = self
|
||||
.request(Method::POST, &create_label_url)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(serde_json::to_string(&body).context(SerializingSnafu)?)
|
||||
.send()
|
||||
.await
|
||||
|
@ -100,6 +101,7 @@ impl Client {
|
|||
let body = LabelUpdate { name, properties };
|
||||
let response = self
|
||||
.request(Method::PATCH, &update_label_url)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(serde_json::to_string(&body).context(SerializingSnafu)?)
|
||||
.send()
|
||||
.await
|
||||
|
@ -198,6 +200,7 @@ mod tests {
|
|||
|
||||
let mock_server = mock("POST", BASE_PATH)
|
||||
.match_header("Authorization", format!("Token {}", token).as_str())
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(
|
||||
format!(
|
||||
r#"{{"orgID":"{}","name":"{}","properties":{{"some-key":"some-value"}}}}"#,
|
||||
|
@ -222,6 +225,7 @@ mod tests {
|
|||
|
||||
let mock_server = mock("POST", BASE_PATH)
|
||||
.match_header("Authorization", format!("Token {}", token).as_str())
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(format!(r#"{{"orgID":"{}","name":"{}"}}"#, org_id, name).as_str())
|
||||
.create();
|
||||
|
||||
|
@ -242,6 +246,7 @@ mod tests {
|
|||
|
||||
let mock_server = mock("PATCH", format!("{}/{}", BASE_PATH, label_id).as_str())
|
||||
.match_header("Authorization", format!("Token {}", token).as_str())
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(
|
||||
format!(
|
||||
r#"{{"name":"{}","properties":{{"some-key":"some-value"}}}}"#,
|
||||
|
@ -267,6 +272,7 @@ mod tests {
|
|||
|
||||
let mock_server = mock("PATCH", format!("{}/{}", BASE_PATH, label_id).as_str())
|
||||
.match_header("Authorization", format!("Token {}", token).as_str())
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body("{}")
|
||||
.create();
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ impl Client {
|
|||
|
||||
let response = self
|
||||
.request(Method::POST, &setup_init_url)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(serde_json::to_string(&body).context(SerializingSnafu)?)
|
||||
.send()
|
||||
.await
|
||||
|
@ -94,6 +95,7 @@ impl Client {
|
|||
|
||||
let response = self
|
||||
.request(Method::POST, &setup_new_url)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(serde_json::to_string(&body).context(SerializingSnafu)?)
|
||||
.send()
|
||||
.await
|
||||
|
@ -138,6 +140,7 @@ mod tests {
|
|||
let retention_period_hrs = 1;
|
||||
|
||||
let mock_server = mock("POST", "/api/v2/setup")
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(
|
||||
format!(
|
||||
r#"{{"username":"{}","org":"{}","bucket":"{}","password":"{}","retentionPeriodHrs":{}}}"#,
|
||||
|
@ -173,6 +176,7 @@ mod tests {
|
|||
|
||||
let mock_server = mock("POST", "/api/v2/setup/user")
|
||||
.match_header("Authorization", format!("Token {}", token).as_str())
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(
|
||||
format!(
|
||||
r#"{{"username":"{}","org":"{}","bucket":"{}","password":"{}","retentionPeriodHrs":{}}}"#,
|
||||
|
@ -204,6 +208,7 @@ mod tests {
|
|||
let bucket = "some-bucket";
|
||||
|
||||
let mock_server = mock("POST", "/api/v2/setup")
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(
|
||||
format!(
|
||||
r#"{{"username":"{}","org":"{}","bucket":"{}"}}"#,
|
||||
|
@ -231,6 +236,7 @@ mod tests {
|
|||
|
||||
let mock_server = mock("POST", "/api/v2/setup/user")
|
||||
.match_header("Authorization", format!("Token {}", token).as_str())
|
||||
.match_header("Content-Type", "application/json")
|
||||
.match_body(
|
||||
format!(
|
||||
r#"{{"username":"{}","org":"{}","bucket":"{}"}}"#,
|
||||
|
|
Loading…
Reference in New Issue