Commit graph

1294 commits

Author SHA1 Message Date
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
David Pedersen
409a6651f5
Update dependencies (#753) 2022-02-12 17:16:14 +00:00
David Pedersen
1e51ea9423
Fix rejection status codes (#751) 2022-02-09 10:19:31 +00:00
Mike Miller
16ee83a799
Add Jotsy to project showcase (#746) 2022-02-05 16:14:36 +01:00
Nicolas del Valle
4daaad8071
Add Rustapi to project showcase section (#745) 2022-02-05 00:41:15 +01:00
Evgenii
0c16ce7649
fix: typo in a comment in a sqlx-postgres example (#744) 2022-02-04 08:14:34 +01:00
Austin Bonander
4a6e164cf3
ECOSYSTEM.md: mention realworld-axum-sqlx (#741) 2022-02-01 08:10:03 +01:00
David Pedersen
15914c4f15
Remove axum-debug code (#740) 2022-01-31 22:46:44 +01:00
David Pedersen
9ddcd22031
axum-debug: Version 0.3.3 (#737) 2022-01-31 22:06:43 +01:00
David Pedersen
c1cc4b515a Update axum-macros changelog with initial release date 2022-01-31 20:06:59 +01:00
Ibraheem Ahmed
2eab37280c
update matchit to 0.4.6 (#736) 2022-01-31 19:06:24 +00:00
Eray Karatay
720b2ba0c4
fix crates.io links (#735) 2022-01-31 17:09:55 +01:00
David Pedersen
515495d957
Set content-length for responses to HEAD requests (#734)
* Set `content-length` internally in `Router`

* changelog

* require `B: HttpBody` at the `impl`

* add changelog refs
2022-01-31 13:48:51 +01:00