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

Log errors deserializing request bodies #76

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

plcplc
Copy link
Contributor

@plcplc plcplc commented Nov 7, 2023

We want to log when we cannot fundamentally make sense of the requests we receive.

@plcplc plcplc requested a review from SamirTalwar November 7, 2023 21:32
details: serde_json::Value::String(rejection.body_text()),
};
let payload = serde_json::to_value(error).unwrap();
(rejection.status(), extract::Json(payload)).into_response()
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems a little bananas to me. Why are we using an extractor in a response?

I realize you didn't write this, but it does not seem correct.

Let's look into this separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out that this makes sense to an extent, since it appears to be Axum's way to communicate/build up IntoResponse trait implementations from smaller parts: https://docs.rs/axum/0.6.20/axum/response/trait.IntoResponse.html

@plcplc plcplc merged commit 42f362a into main Nov 8, 2023
3 checks passed
@SamirTalwar SamirTalwar deleted the plc/issues/NDAT-966-jsonrejection branch March 11, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants