tangled
alpha
login
or
join now
nonbinary.computer
/
jacquard
80
fork
atom
A better Rust ATProto crate
80
fork
atom
overview
issues
9
pulls
pipelines
bugfix for axum extractor
Orual
5 months ago
f91c371a
007ce354
1/1
build.yml
success
1min 13s
+30
-11
2 changed files
expand all
collapse all
unified
split
CHANGELOG.md
crates
jacquard-axum
src
lib.rs
+10
CHANGELOG.md
···
1
1
# Changelog
2
2
3
3
+
## `jacquard-axum` [0.4.2] - 2025-10-13
4
4
+
5
5
+
### Fixed
6
6
+
7
7
+
- Axum extractor now sets the correct Content-Type header during error path.
8
8
+
9
9
+
---
10
10
+
3
11
## [0.5.0] - 2025-10-13
4
12
5
13
### Added
···
51
59
- Minor improvements to derive macros (`jacquard-derive`)
52
60
- Identity resolution refinements (`jacquard-identity`)
53
61
- OAuth client improvements (`jacquard-oauth`)
62
62
+
63
63
+
---
54
64
55
65
## [0.4.0] - 2025-10-11
56
66
+20
-11
crates/jacquard-axum/src/lib.rs
···
46
46
//! [`IntoStatic`], avoiding the DeserializeOwned requirement of the Json axum extractor and similar.
47
47
48
48
use axum::{
49
49
-
Router,
49
49
+
Json, Router,
50
50
body::Bytes,
51
51
extract::{FromRequest, Request},
52
52
-
http::StatusCode,
52
52
+
http::{HeaderValue, StatusCode, header},
53
53
response::{IntoResponse, Response},
54
54
};
55
55
use jacquard::{
···
88
88
Ok(value) => Ok(ExtractXrpc(*value.into_static())),
89
89
Err(err) => Err((
90
90
StatusCode::BAD_REQUEST,
91
91
-
serde_json::to_string(&json!({
91
91
+
[(
92
92
+
header::CONTENT_TYPE,
93
93
+
HeaderValue::from_static("application/json"),
94
94
+
)],
95
95
+
Json(json!({
92
96
"error": "InvalidRequest",
93
97
"message": format!("failed to decode request: {}", err)
94
94
-
}))
95
95
-
.expect("Failed to serialize error response"),
98
98
+
})),
96
99
)
97
100
.into_response()),
98
101
}
···
104
107
serde_html_form::from_str::<R::Request<'_>>(query).map_err(|e| {
105
108
(
106
109
StatusCode::BAD_REQUEST,
107
107
-
serde_json::to_string(&json!({
110
110
+
[(
111
111
+
header::CONTENT_TYPE,
112
112
+
HeaderValue::from_static("application/json"),
113
113
+
)],
114
114
+
Json(json!({
108
115
"error": "InvalidRequest",
109
116
"message": format!("failed to decode request: {}", e)
110
110
-
}))
111
111
-
.expect("Failed to serialize error response"),
117
117
+
})),
112
118
)
113
119
.into_response()
114
120
})?;
···
116
122
} else {
117
123
Err((
118
124
StatusCode::BAD_REQUEST,
119
119
-
serde_json::to_string(&json!({
125
125
+
[(
126
126
+
header::CONTENT_TYPE,
127
127
+
HeaderValue::from_static("application/json"),
128
128
+
)],
129
129
+
Json(json!({
120
130
"error": "InvalidRequest",
121
131
"message": "wrong nsid for wherever this ended up"
122
122
-
}))
123
123
-
.expect("Failed to serialize error response"),
132
132
+
})),
124
133
)
125
134
.into_response())
126
135
}