1
0
Fork 0
mirror of https://github.com/tokio-rs/axum.git synced 2025-01-28 10:44:49 +01:00
Commit graph

185 commits

Author SHA1 Message Date
David Pedersen
f1769e5134
Re-organize changelog to make updating to 0.6 easier () 2022-08-20 21:11:02 +02:00
David Pedersen
18dd830b84
Add #[non_exhaustive] to ProtoBufRejection () 2022-08-19 10:17:40 +00:00
David Pedersen
e7f1c88cd4
Always store state in an Arc ()
* 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
David Pedersen
423308de3c
Add type safe state extractor ()
* begin threading the state through

* Pass state to extractors

* make state extractor work

* make sure nesting with different states work

* impl Service for MethodRouter<()>

* Fix some of axum-macro's tests

* Implement more traits for `State`

* Update examples to use `State`

* consistent naming of request body param

* swap type params

* Default the state param to ()

* fix docs references

* Docs and handler state refactoring

* docs clean ups

* more consistent naming

* when does MethodRouter implement Service?

* add missing docs

* use `Router`'s default state type param

* changelog

* don't use default type param for FromRequest and RequestParts

probably safer for library authors so you don't accidentally forget

* fix examples

* minor docs tweaks

* clarify how to convert handlers into services

* group methods in one impl block

* make sure merged `MethodRouter`s can access state

* fix docs link

* test merge with same state type

* Document how to access state from middleware

* Port cookie extractors to use state to extract keys ()

* Updates ECOSYSTEM with a new sample project ()

* Avoid unhelpful compiler suggestion ()

* fix docs typo

* document how library authors should access state

* Add `RequestParts::with_state`

* fix example

* apply suggestions from review

* add relevant changes to axum-extra and axum-core changelogs

* Add `route_service_with_tsr`

* fix trybuild expectations

* make sure `SpaRouter` works with routers that have state

* Change order of type params on FromRequest and RequestParts

* reverse order of `RequestParts::with_state` args to match type params

* Add `FromRef` trait ()

* Add `FromRef` trait

* Remove unnecessary type params

* format

* fix docs link

* format examples

* Avoid unnecessary `MethodRouter`

* apply suggestions from review

Co-authored-by: Dani Pardo <dani.pardo@inmensys.com>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-08-17 15:13:31 +00:00
David Pedersen
90dbd52ee4
Fix lint warnings () 2022-08-17 09:41:52 +00:00
David Pedersen
f2243c4db0
Make WithRejection::into_inner public () 2022-08-17 08:59:16 +00:00
David Pedersen
e22f6f9d2b
Add Either{2..8} to axum-extra ()
* Add `Either{2..8}`

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* Either2 => Either

* Update axum-extra/src/either.rs

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-08-17 08:57:19 +00:00
Altair Bueno
fb21561616
Add WithRejection ()
* 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 <david.pdrsn@gmail.com>

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

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>

* 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 <david.pdrsn@gmail.com>
2022-08-17 07:59:25 +00:00
David Pedersen
01630cfef6
Add sync constructors to CookieJar, SignedCookieJar, and PrivateCookieJar ()
* Add sync constructors to `CookieJar`, `SignedCookieJar`, and `PrivateCookieJar`

* Move to constructor

* use `RequestParts::extract`
2022-08-16 15:42:01 +02:00
David Pedersen
fb32fcc07c Add protobuf extractor and response to changelog 2022-08-15 15:57:07 +02:00
David Pedersen
50a4be999d
Update matchit and fix nesting inconsistencies ()
* Break `Router::nest` into `nest` and `nest_service` methods

* fix doc tests

* update docs

* fix

* Only accept `Router` in `Resource::{nest, nest_collection}`

* update changelog

* fix docs

* fix `MatchedPath` with `Router`s nested with `nest_service`

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* adjust docs for fallbacks

* Always nest services as opaque

* fix old docs reference

* more tests for `MatchedPath` with nested handlers

* minor clean up

* use identifier captures in format strings

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* fix test

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-08-11 10:17:08 +00:00
Filip Kieres
7faf059234
Document browsers ignoring SSE events without data fields () () 2022-08-10 17:14:42 +02:00
David Pedersen
e79820dbc4
Support chaining handlers with one.or(two).or(three) ()
* WIP: Handler fallbacks

* Docs

* box futures a bit less

* changelog
2022-08-10 10:09:08 +00:00
Jonas Platte
7cbb7cf135
Use new Cargo features to avoid implicit features for optional dependencies ()
* 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
141198ce19
Declare MSRV in Cargo manifests, not .clippy.toml () 2022-07-28 15:31:47 +02:00
Jonas Platte
e6fb53fd68
Fix a typo in axum_extra::extract::Query docs () 2022-07-27 16:32:21 +02:00
David Pedersen
10ab8c7aba
Add missing cfg to axum_extra::extract::Form () 2022-07-26 00:25:45 +02:00
David Pedersen
b243e171fd
Accept S::Response: IntoResponse everywhere () 2022-07-19 18:55:15 +02:00
SzudemJ
73041c8988
Avoid exposure of type names by QueryRejection () 2022-07-18 13:43:18 +00:00
David Pedersen
8c9998eab7
Don't derive debug impl for Resource ()
We don't actually require `B` to be `Debug` but the derived impl does.
2022-07-11 09:41:41 +02:00
Jonas Platte
8c31bee9bc
docsrs cfg fixes ()
* Remove unused attribute in axum-core

* Fix docs.rs package metadata for axum-extra
2022-07-01 13:35:52 +02:00
David Pedersen
a4c820420d
Remove trailing slash redirects ()
* Prepare axum-next branch

* Remove deprecated `extractor_middleware` function ()

* Allow `Error: Into<Infallible>` for `Route::{layer, route_layer}` ()

* Allow `Error: Into<Infallible>` for `Route::{layer, route_layer}` ()

* Allow `Error: Into<Infallible>` for `Route::{layer, route_layer}`

Fixes https://github.com/tokio-rs/axum/issues/922

* changelog

* fixup changelog

* Panic on overlapping routes in `MethodRouter` ()

* Panic on overlapping routes in `MethodRouter`

* changelog link

* add test to ensure `head` and `get` don't overlap

* Fix changelog

* Prepare axum-next branch

* Remove trailing slash redirects

* changelog link

* Fix changelog

* remove asserting to make make the test more clear

* remove tsr related feature

* Add `RouterExt::route_with_tsr`

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* Update axum-extra/src/routing/mod.rs

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* fix typos in docs

* Update axum/CHANGELOG.md

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* mention `RouterExt::route_with_tsr` in the changelog

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-06-30 00:22:43 +02:00
David Pedersen
905bbfb8e2
axum-extra: Version 0.3.5 () 2022-06-27 21:08:12 +02:00
David Pedersen
523c7fed88 Depend on right version of tokio-stream 2022-06-25 12:26:37 +02:00
David Pedersen
6b6a415622
Add JsonLines extractor and response () 2022-06-20 20:49:18 +02:00
David Pedersen
93251fa203
Bump MSRV to 1.56 and update to the 2021 edition () 2022-06-17 20:11:35 +02:00
David Pedersen
453202b490
Document all cargo features () 2022-06-10 08:46:09 +02:00
David Pedersen
fbb4786851
axum-extra: Version 0.3.4 () 2022-06-08 15:58:37 +02:00
David Pedersen
73b1bafbf8
Add AsyncReadBody ()
* Add `AsyncReadBody`

* changelog

* sort cargo.toml
2022-06-08 11:02:42 +02:00
David Pedersen
8ff275499b Add to changelogs 2022-06-06 18:00:52 +02:00
David Pedersen
19fe93262f
Use impl IntoResponse less in docs () 2022-05-22 13:41:29 +02:00
Jonas Platte
1d7878c3c8
axum-extra: 0.3.3 ()
* axum-extra: 0.3.3

* Update axum-extra/CHANGELOG.md

* Update axum-extra/CHANGELOG.md

* depend on axum-macros 0.2.2

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-05-18 20:29:49 +02:00
David Pedersen
5948cde6c1
Support customizing rejections for #[derive(TypedPath)] ()
* Support customizing rejections for `#[derive(TypedPath)]`

* changelog

* clean up
2022-05-17 21:36:05 +02:00
Jonas Platte
b215a87a19
Add axum_extra::extract::Query 2022-05-17 20:19:24 +02:00
David Pedersen
3e722379ac Add changelog link 2022-05-15 20:07:29 +02:00
David Pedersen
61c4e19598
axum-extra: 0.3.2 () 2022-05-15 20:01:00 +02:00
David Pedersen
178e1801e9
Add axum_extra::extract::Form ()
* Add `axum_extra::extra::Form`

* update tokio-util ban
2022-05-15 15:17:45 +00:00
David Pedersen
cfdac03c8d
axum-extra: Version 0.3.1 () 2022-05-10 12:05:36 +00:00
David Pedersen
46e6d3493b
axum-macros: Version 0.2.1 () 2022-05-10 11:46:17 +00:00
David Pedersen
b5183afbec
Support wildcards in typed paths ()
* Support wildcards in typed paths

* changelog
2022-05-06 13:05:30 +02:00
David Pedersen
4ff78e552d
Support Option and Result in typed paths ()
* Support `Option` and `Result` in typed paths

* changelog

* Update axum-extra/CHANGELOG.md

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* fix one more

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-05-06 09:42:10 +02:00
David Pedersen
a3b6cbc99c
axum-extra: Version 0.3.0 ()
* axum-extra: Version 0.3.0

* add tower-http update to changelog
2022-04-27 10:27:41 +02:00
David Pedersen
700617963f
Move private and signed cookies behind feature flags ()
* 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
79f6cde3b1
Update to tower-http 0.3.0 ()
* Update to tower-http 0.3.0

* changelog link
2022-04-25 14:59:16 +00:00
Fxxxlei
3747650ae9
Remove unnecessary default features for axum from axum-extra ()
* Remove unnecessary default features for axum from axum-extra

* Update changelog

Co-authored-by: Leon Felix List <uwdxx@student.kit.edu>
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-04-07 08:24:01 +00:00
David Pedersen
530b0906f7 Fix changelog date 2022-04-03 20:20:50 +02:00
David Pedersen
950dde2664 axum-extra: Version 0.2.1 2022-04-03 20:18:01 +02:00
David Pedersen
405e3f8c44
Add SpaRouter () 2022-04-03 18:29:37 +02:00
David Pedersen
01a4c88d7a
Add PrivateCookieJar () 2022-04-01 16:37:55 +02:00
David Pedersen
da3ca22301
Fix SignedCookieJar with custom key type () 2022-04-01 11:40:42 +02:00