Skip to content

Commit 65b9317

Browse files
authored
rename DefaultFormat to JsonFormat
1 parent a22a9f1 commit 65b9317

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

sdk/typespec/typespec_client_core/src/http/format.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<F: Format> DeserializeWith<F> for ResponseBody {
4040
/// that implements [`serde::de::DeserializeOwned`] by deserializing the response body to the specified type using [`serde_json`].
4141
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
4242
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
43-
impl<D: DeserializeOwned> DeserializeWith<DefaultFormat> for D {
43+
impl<D: DeserializeOwned> DeserializeWith<JsonFormat> for D {
4444
async fn deserialize_with(body: ResponseBody) -> typespec::Result<Self> {
4545
body.json().await
4646
}
@@ -51,9 +51,9 @@ impl<D: DeserializeOwned> DeserializeWith<DefaultFormat> for D {
5151
/// This format supports deserializing response bodies to:
5252
/// * [`ResponseBody`] - The raw response body, without any deserialization.
5353
/// * Any value implementing [`serde::de::DeserializeOwned`] - Deserializes the response body to the specified type using JSON deserialization.
54-
pub struct DefaultFormat;
54+
pub struct JsonFormat;
5555

56-
impl Format for DefaultFormat {}
56+
impl Format for JsonFormat {}
5757

5858
/// A [`Format`] that deserializes response bodies using XML.
5959
#[cfg(feature = "xml")]

sdk/typespec/typespec_client_core/src/http/pipeline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::http::{
77
};
88
use std::sync::Arc;
99

10-
use super::DefaultFormat;
10+
use super::JsonFormat;
1111

1212
/// Execution pipeline.
1313
///
@@ -84,7 +84,7 @@ impl Pipeline {
8484
&self,
8585
ctx: &Context<'_>,
8686
request: &mut Request,
87-
) -> crate::Result<Response<T, DefaultFormat>> {
87+
) -> crate::Result<Response<T, JsonFormat>> {
8888
self.pipeline[0]
8989
.send(ctx, request, &self.pipeline[1..])
9090
.await

sdk/typespec/typespec_client_core/src/http/response.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//! HTTP responses.
55
6-
use crate::http::{headers::Headers, DefaultFormat, DeserializeWith, Format, StatusCode};
6+
use crate::http::{headers::Headers, DeserializeWith, Format, JsonFormat, StatusCode};
77
use bytes::Bytes;
88
use futures::{Stream, StreamExt};
99
use serde::de::DeserializeOwned;
@@ -24,7 +24,7 @@ pub type PinnedStream = Pin<Box<dyn Stream<Item = crate::Result<Bytes>>>>;
2424
/// Given a `Response<T>`, a user can deserialize the body into the intended body type `T` by calling [`Response::into_body`].
2525
/// However, because the type `T` is just a marker type, the user can also deserialize the body into a different type by calling [`Response::into_json_body`] or [`Response::into_xml_body`],
2626
/// or access the raw body using [`Response::into_raw_body`].
27-
pub struct Response<T = ResponseBody, F = DefaultFormat> {
27+
pub struct Response<T = ResponseBody, F = JsonFormat> {
2828
status: StatusCode,
2929
headers: Headers,
3030
body: ResponseBody,

0 commit comments

Comments
 (0)