From e06c4014285f0dddd4926e84ee8b9da57c99ed74 Mon Sep 17 00:00:00 2001 From: Damien Murphy Date: Sat, 13 Jul 2024 17:24:12 -0700 Subject: [PATCH] fix build errors --- src/speak/rest.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/speak/rest.rs b/src/speak/rest.rs index a10ec704..8c4e94e5 100644 --- a/src/speak/rest.rs +++ b/src/speak/rest.rs @@ -6,7 +6,7 @@ use options::{Options, SerializableOptions}; use reqwest::RequestBuilder; -use serde_json::json; +use serde_json::Value; use std::fs::File; use std::io::copy; use std::path::Path; @@ -26,12 +26,19 @@ impl<'a> Speak<'a> { options: &Options, output_file: &Path, ) -> crate::Result<()> { + let payload = Value::Object( + [("text".to_string(), Value::String(text.to_string()))] + .iter() + .cloned() + .collect(), + ); + let request_builder = self .0 .client .post(self.speak_url()) .query(&SerializableOptions(options)) - .json(&json!({ "text": text })); + .json(&payload); self.send_and_translate_response(request_builder, output_file) .await