Skip to content

Commit 6438e7b

Browse files
committed
controllers::user::session: Use json! macro to simplify JSON serialization code
1 parent 611c5db commit 6438e7b

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/controllers/user/session.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,7 @@ pub fn begin(req: &mut dyn RequestExt) -> EndpointResult {
3636
req.session_mut()
3737
.insert("github_oauth_state".to_string(), state.clone());
3838

39-
#[derive(Serialize)]
40-
struct R {
41-
url: String,
42-
state: String,
43-
}
44-
Ok(req.json(&R {
45-
url: url.to_string(),
46-
state,
47-
}))
39+
Ok(req.json(&json!({ "url": url.to_string(), "state": state })))
4840
}
4941

5042
/// Handles the `GET /api/private/session/authorize` route.

0 commit comments

Comments
 (0)