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
Jonas Platte
89e9d1bff1
Put the Form and Query extractors behind (default-on) Cargo features ( #775 )
...
* Put the Form extractor behind a (default-activated) Cargo feature
* Put the Query behind a (default-activated) Cargo feature
2022-02-22 10:12:24 +01:00
Clayton Faria
4473efd1e6
fix typo in the docs ( #774 )
2022-02-22 10:06:56 +01:00
David Pedersen
7a228a584b
Type safe routing ( #756 )
...
* wip
* wip
* make macro implement trait
* checkpoint
* checkpoint
* Simplify things quite a bit
* re-export `axum_macros::TypedPath` from `axum_extra`
* docs
* add missing feature
* fix docs link
* fix features
* fix missing imports
* make serde an optional dep again
* ui tests
* Break things up a bit
* Update span for `FromRequest` impls to point to callsite
* make docs feature labels show up automatically
* Apply suggestions from code review
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
* add note about Display/Serialize being compatible
* Update axum-extra/src/routing/typed.rs
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
* fix missing docs link
* what about typed methods?
* Revert "what about typed methods?"
This reverts commit cc1f989467
.
* don't allow wildcards for now
* percent encode params
* Update axum-extra/src/routing/typed.rs
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
* rephrase args
* changelog
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-02-18 14:13:56 +01:00
Olivier Pinon
d12494cc9c
Add IntoResponse impl for BytesMut and Chain ( #767 )
...
* Add IntoResponse impl for BytesMut and Chain
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
* Add CHANGELOG entry
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-02-17 13:30:42 +01:00
Jonas Platte
2b608c4532
Fix doc(cfg)s ( #765 )
...
* Use automatic doc(cfg) attributes where possible
* Add missing feature documentation
* Replace redundant cfg attribute with doc(cfg)
* Remove non-existent feature from package.metadata.playground.features
* Add missing cfg's on rejection types
2022-02-17 11:43:16 +01:00
Tom Hacohen
6bd8b8a232
ECOSYSTEM: add the Svix webhooks service ( #762 )
...
* ECOSYSTEM: add the Svix webhooks service
* Update ECOSYSTEM.md
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-02-16 13:25:50 +01:00
frobiac
8c0926ee5b
examples(jwt): Claims.exp represents a UTC timestamp ( #760 )
...
For the example to work, it should be an epoch value in the future.
See d8a33def00/README.md (L61)
2022-02-15 21:43:31 +00:00
David Pedersen
8b551dcbf2
Fix broken docs link
2022-02-15 22:16:23 +01:00
zys864
5442cd7281
remove unused tokio-util
dependency ( #758 )
2022-02-15 07:27:59 +00:00
David Pedersen
c135436cc9
Fix setting content-length: 0
for HEAD responses with compression middleware ( #755 )
...
* Fix getting `content-length` for `chunked` responses
Fixes #747
* changelog
* Fix `cargo deny bans`
https://github.com/tokio-rs/axum/pull/753 will fix things properly
2022-02-14 09:56:08 +00:00