Commit graph

629 commits

Author SHA1 Message Date
Evan Schwartz
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 <david.pdrsn@gmail.com>
2022-03-31 10:03:06 +02:00
Grzegorz Baranski
79501afd10
add ezsockets to community maintained ecosyste (#885) 2022-03-26 16:22:07 +01:00
Tv
dee4e73af4
Typos in docstrings (#886) 2022-03-24 20:56:05 +01:00
Marcus Griep
6aa678e8f2
docs: Add aliri_tower as an ecosystem project (#883) 2022-03-24 20:55:12 +01:00
David Pedersen
56e2d57320
Change Handler to have an associated Future type (#879)
* Change `Handler` to have an associated `Future` type

This removes `#[async_trait]` from `Handler` and replaces that with an
associated `Future` type.

As hinted at in #878 I'm working on something with types that need to
implement `Handler`. I'm doing that by wrapping other `Handler` types so
I can implement `Handler` by simply delegating and thus don't need to
allocate another box for `#[async_trait]`. This change makes that
possible.

It does make `Handler` less ergonomic to implement but thats a very
niche feature so I'm fine with that. It wouldn't be appropriate for
`FromRequest` IMO.

* changelog
2022-03-21 13:32:06 +00:00
David Pedersen
6175f95f41
Unseal handler trait (#878) 2022-03-21 11:55:31 +01:00
David Pedersen
2c985246ba
Fix out of date docs for Json (#871)
Fixes https://github.com/tokio-rs/axum/issues/865
2022-03-19 01:24:28 +01:00
David Pedersen
437fe5b931
Make status codes for JsonRejection more precise (#868)
* Fix status codes for `JsonRejection` rejections

Fixes #865

* Apply suggestions from code review

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

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-03-18 16:53:39 +01:00
David Pedersen
33ee55e52c
Add example for consuming request body in middleware and extractor (#861) 2022-03-18 15:41:38 +00:00
Nathaniel McCallum
30b2cf8f96
Implement From<S> for StreamBody<S> (#866)
Although this shadows `StreamBody::new()`, having `From` allows for
trivial bounds creation on associated types.

Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
2022-03-18 15:40:27 +00:00
David Pedersen
a0ae0c48aa
Make RequestParts::body_mut return &mut Option<B> (#869) 2022-03-18 15:39:13 +00:00
David Pedersen
debc3f5be9
Don't run nightly on CI (#870)
* Exclude sqlx example

Getting an ICE
https://github.com/tokio-rs/axum/runs/5602144413?check_suite_focus=true.
Will look into that later.

* actually it was nightly's fault

* and don't test things on nightly
2022-03-18 16:28:23 +01:00
Jonas Platte
422a883cb2
Fix two separate lists in Tutorials section of ECOSYSTEM.md (#854) 2022-03-12 22:09:30 +01:00
Joel Parker Henderson
770fe8bbeb
Add ecosystem tutorial link to demo-rust-axum (#852) 2022-03-12 18:54:01 +01:00
Jonas Platte
80753f8f5c
Remove unnecessary mut from (Signed)CookieJar examples (#850) 2022-03-10 12:53:51 +01:00
David Pedersen
88974f4299
Add missing changelog items (#845)
* Add missing changelog items

* Update axum/CHANGELOG.md

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

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-03-09 15:07:41 +00:00
David Pedersen
14960e9a11 fix changelog links 2022-03-09 15:43:54 +01:00
David Pedersen
401c7a324a
Fix routing for opaque nested services (#842)
* Fix routing for opaque nested services

* Also test `MatchedPath`

* clean up and more comments
2022-03-09 11:25:06 +01:00
David Pedersen
70e3024068
Don't set extension we never use (#844)
* Remove unused internal helper

* Don't set extension we never use
2022-03-09 11:05:24 +01:00
David Pedersen
f9a94ca7eb
Add security note about extract::Host (#839) 2022-03-09 10:18:12 +01:00
Ibraheem Ahmed
04dd7617a4
update to matchit 0.5 (#843) 2022-03-09 09:28:19 +01:00
David Pedersen
19eda2f566 fix ups: include all crates in workspace 2022-03-08 21:32:54 +01:00
David Pedersen
dfa2e3b09f
Fix nesting of opaque services that paths that contain params (#841)
* checkpoint

* fix it

* more consistent macros

* fix msrv
2022-03-08 21:27:44 +01:00
David Pedersen
0600eff31a
Use IntoResponse rather than Response::builder internally (#837) 2022-03-07 16:49:03 +01:00
David Pedersen
87a2b0dac1
Implement IntoResponseParts for Option<T> (#838) 2022-03-07 16:37:34 +01:00
Trent
843437b501
Add Host extractor (#827) 2022-03-06 16:29:10 +00:00
David Pedersen
b05a5c6dfe
Make it more obvious that NEST_TAIL_PARAM is reserved (#836) 2022-03-06 16:01:14 +00:00
David Pedersen
a438e6b106
Refactor storing URL params in extensions (#833) 2022-03-06 12:41:16 +01:00
Jonas Platte
79b94b9bd6
Replace set_var usage in examples (#829)
* examples: Fix inconsistent toml formatting

* examples: Replace set_var usage
2022-03-06 12:37:00 +01:00
Jonas Platte
9470f5ae1d
Update MSRV in .clippy.toml (#832) 2022-03-05 14:23:27 +01:00
Jonas Platte
b6862ff63d
ci: Set CARGO_TERM_COLOR = always to get colored logs (#831) 2022-03-05 12:13:53 +01:00
Chris Connelly
903a887eb0
Add axum-sqlx-tx to community projects (#828) 2022-03-05 01:26:40 +01:00
David Pedersen
f045f2356c
Add cookie management to axum-extra (#816)
* Cookie management

* fix feature

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

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

* add tests

* Apply suggestions from code review

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

* less convoluted wording

* changelog

* Make the jars themselves implement `IntoResponseParts`

* dedup tests

* fix docs

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-03-04 10:53:36 +01:00
David Pedersen
ae22154979
Add example for implementing IntoResponseParts (#825) 2022-03-04 10:53:17 +01:00
David Pedersen
1614ef7a22
Fix inconsistent double slash when nesting routes (#824) 2022-03-04 09:28:44 +01:00
David Pedersen
90e74f12c4
Requires paths start with a / (#823)
* Requires routes to start with `/`

* Also check routes in `TypedPath`

* changelog

* changelog links
2022-03-03 23:24:27 +00:00
Jonas Platte
ab486198e6
Fix typo in CHANGELOG.md (#822) 2022-03-04 00:18:37 +01:00
David Pedersen
d943ba6d81
Replace HasRoutes with Into<Router> (#819)
* Move `HasRoutes` into axum

* fix doc test

* Just use `Into<Router>`
2022-03-03 21:50:31 +00:00
Max Bruckner
99fbd3d32c
Add note about order of extractors in the reverse-proxy example (#821) 2022-03-03 22:33:33 +01:00
David Pedersen
1c8f09268b
Implement IntoResponseParts for more tuples (#817) 2022-03-03 08:07:00 +01:00
David Pedersen
5f54855b05
Remove IntoResponse and IntoResponseParts impls for Version (#815) 2022-03-02 13:07:16 +00:00
David Pedersen
84c725a1ae
Make IntoResponseParts more flexible (#813)
* Make `IntoResponseParts` more flexible

* fix `impl<T> IntoResponseParts for TypedHeader<T>`

* fix
2022-03-02 11:41:14 +00:00
David Pedersen
24359ebd4d
Move TypedHeader into root (#803) 2022-03-01 16:00:42 +00:00
David Pedersen
2428d99081
Export AddExtension from middleware (#811)
* Export `AddExtension` from `middleware`

* Move `AddExtension` into `extension` module
2022-03-01 13:59:33 +00:00
David Pedersen
bad3abb960 Remove out of date docs
These accidentally weren't removed in https://github.com/tokio-rs/axum/pull/790
2022-03-01 14:09:30 +01:00
David Pedersen
2de202da40
Remove AddExtensionLayer (#807)
* Remove `AddExtensionLayer`

Its deprecated on 0.4.x so we can remove it from `main`.

* changelog
2022-03-01 13:59:43 +01:00
zys864
768d8a8218
Fix minor issues in some examples (#806)
* remove unused `axum`'s dependency:`tokio-util`

* fix `examples/todos`'s `async fn todos_index` iter_overeager_cloned

* Add docs to `/examples/async-graphql`, just like other xamples.

* remove `examples/async-graphql` unused dependencies `tracing-subscriber` and `trace`

* `examples/chat` deps `trace` and `tracing-subscriber` never be used. Add trace `debug` to `chat`

* remove `examples/print-request-response` unused dependency `axum-extra`

* remove `examples/prometheus-metrics` unused dependency `axum-extra`

* remove `examples/reverse-proxy` unused dependencies `tracing-subscriber` and `trace`

* `examples/chat` fmt fix
2022-03-01 09:30:09 +00:00
David Pedersen
094fd71d1a
Move Extension into root (#804) 2022-03-01 09:12:45 +01:00
David Pedersen
a2b568c7c1
Implement tower::Layer for Extension (#801)
* Implement `tower::Layer` for `Extension`

* changelog
2022-03-01 00:39:22 +01:00
David Pedersen
0d05b5e31f
Remove deprecated APIs (#800)
* Remove deprecations APIs

* changelog
2022-02-28 23:22:21 +00:00