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

[doc] Added notes about extractor precedence #1324

Merged
merged 6 commits into from Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions axum/src/form.rs
Expand Up @@ -16,6 +16,11 @@ use std::ops::Deref;
/// If used as an extractor `Form` will deserialize `application/x-www-form-urlencoded` request
/// bodies into some target type via [`serde::Deserialize`].
///
/// Since parsing form data requires consuming the request body, the `Form` extractor must be
/// *last* if there are multiple extractors in a handler. See ["the order of extractors"][order-of-extractors]
///
/// [order-of-extractors]: extract/index.html#the-order-of-extractors
chrisglass marked this conversation as resolved.
Show resolved Hide resolved
///
/// ```rust
/// use axum::Form;
/// use serde::Deserialize;
Expand Down
5 changes: 5 additions & 0 deletions axum/src/json.rs
Expand Up @@ -25,6 +25,11 @@ use std::ops::{Deref, DerefMut};
/// type.
/// - Buffering the request body fails.
///
/// Since parsing JSON requires consuming the request body, the `Json` extractor must be
/// *last* if there are multiple extractors in a handler. See ["the order of extractors"][order-of-extractors]
///
/// [order-of-extractors]: extract/index.html#the-order-of-extractors
chrisglass marked this conversation as resolved.
Show resolved Hide resolved
///
/// See [`JsonRejection`] for more details.
///
/// # Extractor example
Expand Down