diff --git a/tardis/src/web/web_client.rs b/tardis/src/web/web_client.rs index da7a649..70ef2fa 100644 --- a/tardis/src/web/web_client.rs +++ b/tardis/src/web/web_client.rs @@ -48,10 +48,10 @@ where } /// Plain text body for [`TardisWebClient`], -pub struct PlainText(T); +pub struct PlainText(pub T); /// Json body for [`TardisWebClient`], -pub struct Json<'a, T>(&'a T); +pub struct Json<'a, T>(pub &'a T); impl> TardisRequestBody for PlainText { fn apply_on(self, builder: RequestBuilder) -> RequestBuilder { @@ -319,14 +319,14 @@ impl TardisWebClient { Ok((code, headers, response)) } - async fn to_text(&self, code: u16, headers: HashMap, response: Response) -> TardisResult> { + pub async fn to_text(&self, code: u16, headers: HashMap, response: Response) -> TardisResult> { match response.text().await { Ok(body) => Ok(TardisHttpResponse { code, headers, body: Some(body) }), Err(error) => Err(TardisError::format_error(&format!("[Tardis.WebClient] {error:?}"), "406-tardis-webclient-text-error")), } } - async fn to_json Deserialize<'de>>(&self, code: u16, headers: HashMap, response: Response) -> TardisResult> { + pub async fn to_json Deserialize<'de>>(&self, code: u16, headers: HashMap, response: Response) -> TardisResult> { match response.json().await { Ok(body) => Ok(TardisHttpResponse { code, headers, body: Some(body) }), Err(error) => Err(TardisError::format_error(&format!("[Tardis.WebClient] {error:?}"), "406-tardis-webclient-json-error")),