Commit graph

616 commits

Author SHA1 Message Date
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
David Pedersen
f12ab072c5
Add IntoResponseParts (#797)
* Add `IntoResponseParts`

* docs

* Add test

* don't allow overriding body or response

* macroify impls

* re-order things a bit

* Fix tests

* Also allow overriding version

* Move things into separate modules

* docs

* clean up

* fix trybuild test

* remove churn

* simplify buliding response

* fixup test

* fix docs typo

* Use `HeaderValue::from_static`, might be faster

* Bring back `impl IntoResponse` in example

* Remove blanket impl to improve error message

* don't need to set `content-type`

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* changelog

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-02-28 23:04:33 +00:00
David Pedersen
da74084146
Easily convert typed paths into URIs (#790)
* Easily convert typed paths into URIs

`#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for
easily converting paths into URIs for use with `Redirect` and friends.

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

* Use a method on the `TypedPath` trait to convert to `Uri`

* fix doc ref

* Update changelogs
2022-02-28 09:58:22 +01:00
Matthias Vogelgesang
67c385cd2d
axum-macros: use fully qualified Result type (#796) 2022-02-26 14:27:18 +01:00
David Pedersen
8175b9108f
Improve error for missing extension (#795) 2022-02-25 19:42:36 +01:00
Spyros Roum
e2dc6b3147
Remove outdated documentation (#793)
Fixes: #792
2022-02-25 14:35:43 +00:00
zys864
cb168b96fe
fix examples/todos's async fn todos_index iter_overeager_cloned (#794)
* remove unused `axum`'s dependency:`tokio-util`

* fix `examples/todos`'s `async fn todos_index` iter_overeager_cloned
2022-02-25 15:29:23 +01:00
David Pedersen
4ccc4bea71
Update to tokio-tungstenite 0.17 (#791)
Fixes https://github.com/tokio-rs/axum/issues/781
2022-02-25 10:42:09 +00:00
David Pedersen
07e8a6d8fe Update trybuild test to rust 1.59 output 2022-02-25 11:30:10 +01:00
David Pedersen
e781b7b936
Fix some out of date docs (#784)
Since https://github.com/tokio-rs/axum/pull/698 this section about
`HeaderMap` removing the headers from the request is no longer true.
2022-02-24 16:22:52 +01:00
Grachev Mikhail
ccd7bd91a6
axum-extra: fix typo in CHANGELOG.md (#787)
Signed-off-by: Mikhail Grachev <work@mgrachev.com>
2022-02-24 09:27:50 +01:00
David Pedersen
113a15a713
Document sharing state between handler and middleware (#783)
* Fix heading levels

* Document passing state from middleware to handlers
2022-02-22 16:14:18 +01:00
David Pedersen
49d8fc5093
Make middleware::from_fn response future public (#778)
* Make `middleware::from_fn` response future public

* Make module name consistent with tower
2022-02-22 13:30:47 +01:00
David Pedersen
50606517ac Allow duplicate tokio-util dependency for now
Requires a new release of h2 to fix
2022-02-22 12:19:33 +01:00