Commit Graph
74 Commits
Author SHA1 Message Date
Claas 2eaed0badc Fix PrivateCookieJar documentation example comments (#3053) 2024-11-28 23:00:14 +00:00
Jonas Platte c7aa6454e7 Fix new clippy lints (#3054) 2024-11-28 23:53:20 +01:00
bf0c14b8af Ensure we include the port when parsing authority (#2242)
Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: Yann Simon <[email protected]>
2024-11-14 22:05:58 +01:00
Jonas Platte 56c709b33d Some documentation fixes (#3027) 2024-11-14 21:12:16 +01:00
Vegard SandengenandDavid Mládek 59a2960e42 Add ErrorKind::DeserializeError to specialize ErrorKind::Message (extract::path::ErrorKind) (#2720)
This commit introduces another `extract::path::ErrorKind` variant that captures the
serde error nominally captured through the `serde::de::Error` trait impl on `PathDeserializeError`.
We augment the deserialization error with the captured (key, value), allowing `extract::Path`, and wrapping
extractors, to gain programmatic access to the key name, and attempted deserialized value.

The `PathDeserializationError::custom` is used two places in addition to capture the deserialization error.
These usages should still be unaffected.

Co-authored-by: David Mládek <[email protected]>
2024-11-11 16:56:25 +00:00
Benjamin Sparks ffeb4f9407 Add Scheme extractor (#2507) 2024-10-19 22:04:24 +00:00
David Mládek 65ad603701 chore: fix new clippy lint (#2994) 2024-10-17 12:27:47 +02:00
Jonas Platte 0ddc63f77e Move the Host extractor to axum-extra (#2956) 2024-10-14 22:45:37 +00:00
David Mládek 6318b57fda chore: Upgrade matchit to 0.8 (#2645) 2024-10-03 15:46:58 +00:00
Zheng LiandJonas Platte 19101f624d Replace async_trait with AFIT / RPITIT (#2308)
Co-authored-by: Jonas Platte <[email protected]>
2024-09-28 21:27:11 +00:00
joeydewaal fcb45b8d32 Add an Attachment type to axum-extra (#2789) 2024-06-19 14:28:15 +02:00
mikihiro c6fd852844 Update sync_wrapper to 1.0.0 from 0.1.1
... and fix CI.
2024-03-23 19:46:20 +01:00
David Mládek 2ec68d6c4d Add rejection tracing to all extractors (#2584) 2024-03-16 22:34:18 +01:00
AlphaKeks 9e31949079 Improve documentation of axum_extra::extract::Query (#2517) 2024-01-15 21:49:40 +01:00
Yann Simon f7c4cd883a Fix link to serde::Deserialize (#2498) 2024-01-09 16:25:17 +00:00
David Pedersen c486cc8207 Implement TypedPath for WithRejection<TypedPath, _> (#2491) 2024-01-04 21:08:20 +01:00
David Pedersen 7ea7e9f618 Use IntoFuture for test RequestBuilder (#2470) 2023-12-30 18:23:53 +01:00
future-highway 56159b0d4e JsonDeserializer extractor for zero-copy deserialization (#2431) 2023-12-29 12:06:47 +01:00
David Pedersen 72ccde5900 Update multer (#2433) 2023-12-17 11:31:38 +00:00
Michael Seele e3d34bb553 axum-extra: Use impl Into<Cookie> (#2348) 2023-11-24 21:39:14 +01:00
Davide Ferrero fd7fd9fa71 Upgrade cookie dependency to 0.18
… and replace uses of the deprecated Cookie::named fn.
2023-11-24 12:40:12 +01:00
43b14a5f02 Update to latest versions of hyper and http-body (#1882)
Co-authored-by: Michael Scofield <[email protected]>
Co-authored-by: Jonas Platte <[email protected]>
2023-11-23 11:03:03 +00:00
Mikhail AntoshkinandDavid Pedersen 39cc596e45 Add OptionalQuery extractor (#2310)
Co-authored-by: David Pedersen <[email protected]>
2023-11-18 12:38:30 +00:00
Yuri Astrakhan 786329d85d Use inline format args (#2232) 2023-09-19 06:51:57 +00:00
Jonas Platte 34d1fbc052 Fix typos found by crate-ci/typos 2023-08-08 11:27:45 +02:00
Asger Hautop DrewsenandDavid Pedersen 40da647620 docs: Remove explicit auto deref from PrivateCookieJar example (#2028)
Co-authored-by: David Pedersen <[email protected]>
2023-06-22 21:50:45 +00:00
Azzam S.A 8374c3e789 docs: add warning icon for extractor order (#2027) 2023-06-05 12:05:53 +02:00
877e3fe4de Move TypedHeader to axum-extra (#1850)
Co-authored-by: Michael Scofield <[email protected]>
Co-authored-by: Jonas Platte <[email protected]>
2023-04-21 17:45:31 +02:00
David Pedersen c97967252d Add serve function and remove Server re-export (#1868) 2023-04-21 17:45:31 +02:00
6703f8634c Remove B type param: Follow ups (#1789)
Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: Michael Scofield <[email protected]>
2023-04-21 17:45:31 +02:00
David Pedersen 72c1b7a80c Add Body::from_stream (#1848) 2023-04-21 17:45:31 +02:00
4e4c29175f Remove B type param (#1751)
Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: Michael Scofield <[email protected]>
2023-04-21 17:45:31 +02:00
David Pedersen 6b106f4bab Log built-in rejections (#1890) 2023-04-11 16:57:49 +02:00
David Pedersen 352cf9a266 Implement Deref and DerefMut for built-in extractors (#1922) 2023-04-10 07:18:35 +00:00
Jonas PlatteandDavid Pedersen 43b2d52403 Add OptionalPath extractor (#1889)
Co-authored-by: David Pedersen <[email protected]>
2023-04-09 12:23:13 +00:00
David Pedersen 03e8bc77f1 Implement IntoResponse for MultipartError (#1861) 2023-03-21 08:24:06 +00:00
Dan Handrea e167cfc325 Implement Clone for CookieJar, PrivateCookieJar and SignedCookieJar (#1808) 2023-03-03 11:13:25 +00:00
David Pedersen aa2cbf6920 Add axum_extra::extract::Multipart (#1692) 2023-03-03 10:15:09 +01:00
Rob 68bf8ed7fc Update documentation for FailedToDeserializeQueryString response type (#1795) 2023-02-27 22:29:39 +00:00
avdb ea6eb81d6f Typo fixes (#1628) 2022-12-08 17:50:59 +00:00
David Pedersen 0b26411f39 Change Router::with_state and impl Service for Router<()> (#1552)
* Implement `Service` for `Router<(), B>`

* wip

* wip

* fix some tests

* fix examples

* fix doc tests

* clean up docs

* changelog

* fix

* also call `with_state` when converting `MethodRouter` into a `MakeService`

* suggestions from review
2022-11-24 14:43:10 +00:00
walfie 7d0bb28876 Minor doc fixes (#1562) 2022-11-22 07:08:18 +00:00
Santiago Fraire Willemoes ddee1c1d1a docs: add how to use Arc<AppState> with the cookies examples (#1560) 2022-11-21 14:17:32 +01:00
David Pedersen 64960bb19c Type safe state inheritance (#1532)
* Make state type safe

* fix examples

* remove unnecessary `#[track_caller]`s

* Router::into_service -> Router::with_state

* fixup docs

* macro docs

* add missing docs

* fix examples

* format

* changelog

* Update trybuild tests

* Make sure fallbacks are still inherited for opaque services (#1540)

* Document nesting routers with different state

* fix leftover conflicts
2022-11-18 11:02:58 +00:00
David Pedersen e0ef641e5f Rework Form and Query rejections (#1496)
* Change `FailedToDeserializeQueryString` rejection for `Form`

Its now called `FailedToDeserializeForm`.

* changelog

* Make dedicate rejection type for axum-extra's `Form`

* update trybuild test

* Make dedicate rejection type for axum-extra's `Query`
2022-11-08 20:31:06 +00:00
Jonas Platte 944f388ae0 Add missing cfg's for signed cookie tests 2022-11-05 11:33:27 +01:00
Jonas Platte 410fd49aa9 Fix Cached<T> as the last argument of a handler function (#1428)
* Remove FromRequest impl for Cached<T>

* Add a test for Cached<T> as the last argument of a handler function
2022-09-28 09:06:15 +00:00
Jonas Platte 69d64cecc3 Split RouterService off of Router (#1381) 2022-09-22 12:10:55 +02:00
David PedersenandJonas Platte be624306f4 Only allow last extractor to mutate the request (#1272)
* Only allow last extractor to mutate the request

* Change `FromRequest` and add `FromRequestParts` trait (#1275)

* Add `Once`/`Mut` type parameter for `FromRequest` and `RequestParts`

* 🪄

* split traits

* `FromRequest` for tuples

* Remove `BodyAlreadyExtracted`

* don't need fully qualified path

* don't export `Once` and `Mut`

* remove temp tests

* depend on axum again

Co-authored-by: Jonas Platte <[email protected]>

* Port `Handler` and most extractors (#1277)

* Port `Handler` and most extractors

* Put `M` inside `Handler` impls, not trait itself

* comment out tuples for now

* fix lints

* Reorder arguments to `Handler` (#1281)

I think `Request<B>, Arc<S>` is better since its consistent with
`FromRequest` and `FromRequestParts`.

* Port most things in axum-extra (#1282)

* Port `#[derive(TypedPath)]` and `#[debug_handler]` (#1283)

* port #[derive(TypedPath)]

* wip: #[debug_handler]

* fix #[debug_handler]

* don't need itertools

* also require `Send`

* update expected error

* support fully qualified `self`

* Implement FromRequest[Parts] for tuples (#1286)

* Port docs for axum and axum-core (#1285)

* Port axum-extra (#1287)

* Port axum-extra

* Update axum-core/Cargo.toml

Co-authored-by: Jonas Platte <[email protected]>

* remove `impl FromRequest for Either*`

Co-authored-by: Jonas Platte <[email protected]>

* New FromRequest[Parts] trait cleanup (#1288)

* Make private module truly private again

* Simplify tuple FromRequest implementation

* Port `#[derive(FromRequest)]` (#1289)

* fix tests

* fix docs

* revert examples

* fix docs link

* fix intra docs links

* Port examples (#1291)

* Document wrapping other extractors (#1292)

* axum-extra doesn't need to depend on axum-core (#1294)

Missed this in https://github.com/tokio-rs/axum/pull/1287

* Add `FromRequest` changes to changelogs (#1293)

* Update changelog

* Remove default type for `S` in `Handler`

* Clarify which types have default types for `S`

* Apply suggestions from code review

Co-authored-by: Jonas Platte <[email protected]>

Co-authored-by: Jonas Platte <[email protected]>

* remove unused import

* Rename `Mut` and `Once` (#1296)

* fix trybuild expected output

Co-authored-by: Jonas Platte <[email protected]>
2022-08-22 12:23:20 +02:00
David Pedersen e7f1c88cd4 Always store state in an Arc (#1270)
* Add extension and state benchmarks

* wip

* Arc the state everywhere

* don't require `S: Clone`

* fix example
2022-08-17 20:08:24 +00:00