Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix accidental breaking change to FailedToDeserializeQueryString #1233

Merged
merged 1 commit into from Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions axum-extra/src/extract/form.rs
Expand Up @@ -67,7 +67,7 @@ where
if req.method() == Method::GET {
let query = req.uri().query().unwrap_or_default();
let value = serde_html_form::from_str(query)
.map_err(FailedToDeserializeQueryString::__private_new)?;
.map_err(FailedToDeserializeQueryString::__private_new::<(), _>)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, why is this () instead of T?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that assuming this is released, and the new axum-extra is used with an older version of axum, the message will still include "for type _", but _ will be ().

I guess we can release the new axum 0.5.x release, then update axum-extra's dependency so it has a matching minimum version, and release that 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can release the new axum 0.5.x release, then update axum-extra's dependency so it has a matching minimum version, and release that

Yeah that was my plan.

Ok(Form(value))
} else {
if !has_content_type(req, &mime::APPLICATION_WWW_FORM_URLENCODED) {
Expand All @@ -76,7 +76,7 @@ where

let bytes = Bytes::from_request(req).await?;
let value = serde_html_form::from_bytes(&bytes)
.map_err(FailedToDeserializeQueryString::__private_new)?;
.map_err(FailedToDeserializeQueryString::__private_new::<(), _>)?;

Ok(Form(value))
}
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/extract/query.rs
Expand Up @@ -68,7 +68,7 @@ where
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
let query = req.uri().query().unwrap_or_default();
let value = serde_html_form::from_str(query)
.map_err(FailedToDeserializeQueryString::__private_new)?;
.map_err(FailedToDeserializeQueryString::__private_new::<(), _>)?;
Ok(Query(value))
}
}
Expand Down
2 changes: 1 addition & 1 deletion axum/src/extract/query.rs
Expand Up @@ -59,7 +59,7 @@ where
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
let query = req.uri().query().unwrap_or_default();
let value = serde_urlencoded::from_str(query)
.map_err(FailedToDeserializeQueryString::__private_new)?;
.map_err(FailedToDeserializeQueryString::__private_new::<(), _>)?;
Ok(Query(value))
}
}
Expand Down
2 changes: 1 addition & 1 deletion axum/src/extract/rejection.rs
Expand Up @@ -104,7 +104,7 @@ pub struct FailedToDeserializeQueryString {

impl FailedToDeserializeQueryString {
#[doc(hidden)]
pub fn __private_new<E>(error: E) -> Self
pub fn __private_new<T, E>(error: E) -> Self
where
E: Into<BoxError>,
{
Expand Down
4 changes: 2 additions & 2 deletions axum/src/form.rs
Expand Up @@ -69,7 +69,7 @@ where
if req.method() == Method::GET {
let query = req.uri().query().unwrap_or_default();
let value = serde_urlencoded::from_str(query)
.map_err(FailedToDeserializeQueryString::__private_new)?;
.map_err(FailedToDeserializeQueryString::__private_new::<(), _>)?;
Ok(Form(value))
} else {
if !has_content_type(req, &mime::APPLICATION_WWW_FORM_URLENCODED) {
Expand All @@ -78,7 +78,7 @@ where

let bytes = Bytes::from_request(req).await?;
let value = serde_urlencoded::from_bytes(&bytes)
.map_err(FailedToDeserializeQueryString::__private_new)?;
.map_err(FailedToDeserializeQueryString::__private_new::<(), _>)?;

Ok(Form(value))
}
Expand Down