Commit Graph
21 Commits
Author SHA1 Message Date
Altair BuenoandDavid Pedersen fb21561616 Add WithRejection (#1262)
* new(axum-extra): Added `WithRejection` base impl

Based on @jplatte's version (https://github.com/tokio-rs/axum/issues/1116#issuecomment-1215048273), with slight changes

- Using `From<E::Rejection>` to define the trait bound on a more concise way
- Renamed variables to something more meaningfull

* revert(axum-extra): Removed `with_rejection` feat

* ref(axum-extra): Replaced `match` with `?`

* tests(axum-extra): Added test for `WithRejection`

* examples: Replaced custom `Json` extractor with `WithRejection`

* docs(axum-extra): Added doc to `WithRejection`

* fmt(cargo-check): removed whitespaces

* fmt(customize-extractor-error): missing fmt

* docs(axum-extra): doctest includes `Handler` test

Co-authored-by: David Pedersen <[email protected]>

* docs(axum-extra):` _ `-> `rejection`

Co-authored-by: David Pedersen <[email protected]>

* docs(axum-extra): fixed suggestions

* fix(axum-extra): `WithRejection` manual trait impl

* revert(customize-extractor-error): Undo example changes

refs: d878eede18 , f9200bf4b9

* example(customize-extractor-error): Added reference to `WithRejection`

* docs(axum-extra): Removed `customize-extractor-error` reference

* fmt(axum-extra): cargo fmt

* docs(axum-extra): Added `WithRejection` to CHANGELOG.md

Co-authored-by: David Pedersen <[email protected]>
2022-08-17 07:59:25 +00:00
David Pedersen 01630cfef6 Add sync constructors to CookieJar, SignedCookieJar, and PrivateCookieJar (#1264)
* Add sync constructors to `CookieJar`, `SignedCookieJar`, and `PrivateCookieJar`

* Move to constructor

* use `RequestParts::extract`
2022-08-16 15:42:01 +02:00
Jonas Platte 7cbb7cf135 Use new Cargo features to avoid implicit features for optional dependencies (#1239)
* Fix changelog entry for MSRV change in axum-extra 0.3.5

* Bump MSRV to 1.60 for axum, axum-extra, axum-macros

* Use new Cargo features to avoid implicit features for optional dependencies
2022-08-09 18:43:02 +02:00
Jonas Platte e6fb53fd68 Fix a typo in axum_extra::extract::Query docs (#1201) 2022-07-27 16:32:21 +02:00
David Pedersen 10ab8c7aba Add missing cfg to axum_extra::extract::Form (#1194) 2022-07-26 00:25:45 +02:00
SzudemJ 73041c8988 Avoid exposure of type names by QueryRejection (#1171) 2022-07-18 13:43:18 +00:00
David Pedersen 6b6a415622 Add JsonLines extractor and response (#1093) 2022-06-20 20:49:18 +02:00
David Pedersen 19fe93262f Use impl IntoResponse less in docs (#1049) 2022-05-22 13:41:29 +02:00
Jonas Platte b215a87a19 Add axum_extra::extract::Query 2022-05-17 20:19:24 +02:00
David Pedersen 178e1801e9 Add axum_extra::extract::Form (#1031)
* Add `axum_extra::extra::Form`

* update tokio-util ban
2022-05-15 15:17:45 +00:00
David Pedersen 700617963f Move private and signed cookies behind feature flags (#949)
* move signed cookies into their own module

* Require features for private/signed cookies

* enable "cookie" feature when enabling private/signed cookies

* add `#[cfg]`s in a few more places
2022-04-27 10:11:16 +02:00
David Pedersen 01a4c88d7a Add PrivateCookieJar (#900) 2022-04-01 16:37:55 +02:00
David Pedersen da3ca22301 Fix SignedCookieJar with custom key type (#899) 2022-04-01 11:40:42 +02:00
Paolo Barbolini 1b4c54c6e6 axum-extra: re-export the Expiration and SameSite structs from the cookie crate (#898) 2022-04-01 10:46:43 +02:00
Evan SchwartzandDavid Pedersen 3084dc10ca Accept &str for Redirect (#889)
* Accept &str for Redirect

* Fix doc example

* fix more docs examples

* update changelog

* fix changelog label

Co-authored-by: David Pedersen <[email protected]>
2022-03-31 10:03:06 +02:00
Jonas Platte 80753f8f5c Remove unnecessary mut from (Signed)CookieJar examples (#850) 2022-03-10 12:53:51 +01:00
David PedersenandJonas Platte f045f2356c Add cookie management to axum-extra (#816)
* Cookie management

* fix feature

* Update axum-extra/src/extract/cookie.rs

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

* add tests

* Apply suggestions from code review

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

* less convoluted wording

* changelog

* Make the jars themselves implement `IntoResponseParts`

* dedup tests

* fix docs

Co-authored-by: Jonas Platte <[email protected]>
2022-03-04 10:53:36 +01:00
David PedersenandJonas Platte b1ef0be1a7 Remove RequestParts::take_extensions (#699)
* Remove `RequestParts::take_extensions`

* fix out of date docs

* Remove RequestAlreadyExtracted and replace it with BodyAlreadyExtracted

* fix docs

* fix test

* Update axum-core/src/extract/mod.rs

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

* Remove macro only used once

Co-authored-by: Jonas Platte <[email protected]>
2022-01-23 18:01:52 +01:00
Kai Jewson dfb06e721c Introduce Response type alias as a shorthand for Response<BoxBody> (#590)
* Introduce `Response` type alias as a shorthand

* Don't re-export `Response` at the crate root
2021-12-05 19:16:46 +01:00
Kai Jewson 2b6dba49cb Remove the associated Body type on IntoResponse (#571) 2021-11-28 18:52:18 +01:00
David Pedersen 96b353b556 Add Cached extractor (#565)
* extra: Add `Cached` extractor

`Cached` wraps another extractor and caches its result in request
extensions.

* Use newtype to avoid overriding extensions of the same type

* Rename type param
2021-11-25 10:14:31 +00:00