Commit graph

1025 commits

Author SHA1 Message Date
tottoto
2c74c538dd
Fix clippy warning in example (#1597) 2022-11-29 23:39:11 +00:00
Allan
b1f7ee938d
Update axum-extra feature flag table (#1594) 2022-11-29 22:11:36 +00:00
tottoto
dd4e141f4c
Remove outdated link alias from readme (#1591) 2022-11-29 11:51:44 +01:00
David Pedersen
2121979a48
axum-extra - v0.4.1 (#1590) 2022-11-29 10:57:25 +01:00
David Pedersen
c7985b7858
Fix wrong From impl for Resource (#1589)
Really not sure how this got past the tests.
2022-11-29 09:35:26 +00:00
David Pedersen
87a80ec47b
axum v0.6.1 (#1588) 2022-11-29 08:43:18 +00:00
tottoto
3279d64f96
Update to matchit 0.7 (#1582) 2022-11-27 10:19:01 +01:00
LeoniePhiline
28f1996f9c
Clarify nested outer fallbacks in CHANGELOG.md (#1581) 2022-11-27 01:03:13 +01:00
David Pedersen
eb2e933054
Expand the docs for Router::with_state (#1580) 2022-11-27 01:01:59 +01:00
Ian Alexander Wood
8d62697c72
add axum-http-auth-example to ECOSYSTEM.md (#1574) 2022-11-26 08:47:32 +01:00
David Pedersen
b984fec572 Remove notice about breaking changes from readme 2022-11-25 22:42:35 +01:00
ttys3
834d4e50bc
docs: add axum-otel-metrics to axum ecosystem (#1573) 2022-11-25 17:41:59 +01:00
David Pedersen
1b6780cf6c
axum 0.6 and friends 🎉 (#1570)
* changelog

* bump versions

* reorder changelogs a bit

* Apply suggestions from code review

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

* Expand fallback inheritance

* Reword tsr

* Mention `parse-body-based-on-content-type` example

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-11-25 12:29:58 +00:00
David Pedersen
0b26411f39
Change Router::with_state and impl Service for Router<()> (#1552)
* Implement `Service` for `Router<(), B>`

* wip

* wip

* fix some tests

* fix examples

* fix doc tests

* clean up docs

* changelog

* fix

* also call `with_state` when converting `MethodRouter` into a `MakeService`

* suggestions from review
2022-11-24 14:43:10 +00:00
LeoniePhiline
fde38f6618
docs: Add axum-csrf-sync-pattern to ECOSYSTEM.md (#1567)
This crate provides a Cross-Site Request Forgery protection layer and middleware for use with the axum web framework.

The middleware implements the CSRF Synchronizer Token Pattern for AJAX backends and API endpoints as described in the OWASP CSRF prevention cheat sheet.
2022-11-24 08:59:10 +00:00
freedit-dev
102d5887fa
add showcase freedit (#1559) 2022-11-22 08:26:30 +00:00
jimmycuadra
6771729d27
Improve State and Router docs (#1543) 2022-11-22 09:08:39 +01:00
walfie
7d0bb28876
Minor doc fixes (#1562) 2022-11-22 07:08:18 +00:00
Santiago Fraire Willemoes
ddee1c1d1a
docs: add how to use Arc<AppState> with the cookies examples (#1560) 2022-11-21 14:17:32 +01:00
Max Countryman
c7e696b346
provide links to axum-sessions and axum-login (#1553)
* provide links to axum-sessions and axum-login

* Update ECOSYSTEM.md

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

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-11-20 20:51:51 +00:00
Tshepang Mbambo
3ab3e5f91d
Use http re-export in docs (#1554) 2022-11-20 21:48:41 +01:00
Jonas Platte
8d2fb3618e
Remove unused imports from doctest (#1551) 2022-11-20 01:41:50 +01:00
David Pedersen
b816ac7cdf
Add RouterService::{layer, route_layer} (#1550)
* Add `RouterService::{layer, route_layer}`

Figure we might as well have these.

* changelog
2022-11-19 21:51:55 +00:00
Jonas Platte
ce8ea56f3b
Small improvements to RouterService (#1548)
* Fix docstrings on RouterService methods

* Simplify signatures of RouterService methods with Self type
2022-11-19 22:26:12 +01:00
David Pedersen
99c0224a7c
axum-extra 0.4.0-rc.3 (#1545)
* axum-extra 0.4.0-rc.3

Needs a new release because it uses the old state inheritance whic is
removed in the latest rc.

* fix
2022-11-19 13:02:11 +01:00
Georg Semmler
d5de3bc7e3
Improve compile errors for unimplemented traits (#1436)
* Improve `debug_handler` to use the correct span for specific bounds

This results in better localised error messages, as they now point
directly to the corresponding argument instead of to the macro itself.

* Improve some error messages behind a `nightly-error-messages` feature
flag

This uses the nightly only `rustc_on_unimplemented` attribute to improve
some error messages when users try to use invalid handler functions.
This should be seen as prove of concept, not as full solution for all
potential error cases.

The underlying feature is currently marked as permanently unstable, but
I'm working on getting this specific attribute (or an attribute with
different name, similar functionality) ready to work on a stable compiler.

* Apply suggestions from code review

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

* Enable the `nightly-error-messages` feature unconditionally for nightly compilers

* Use a nightly compiler to run the axum-marcos compile fail tests

* update to newer nightly

* Run axum-macros tests on nightly

* tweak compile error hints a bit

* more tweaks

* update test

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-11-19 12:45:03 +01:00
David Pedersen
2e3000f1a3 Fix typo 2022-11-18 18:36:49 +01:00
David Pedersen
37b9b3df48 Remove duplicate changelog entry 2022-11-18 17:59:05 +01:00
David Pedersen
878ae73e6d
New release candidates (#1541) 2022-11-18 17:29:47 +01:00
David Pedersen
468985373a
Add example of how to test WebSockets (#1535) 2022-11-18 15:40:21 +01:00
David Pedersen
7d58d49817
Add #[from_ref(skip)] (#1537)
For skipping individual fields.
2022-11-18 12:05:10 +01:00
David Pedersen
64960bb19c
Type safe state inheritance (#1532)
* Make state type safe

* fix examples

* remove unnecessary `#[track_caller]`s

* Router::into_service -> Router::with_state

* fixup docs

* macro docs

* add missing docs

* fix examples

* format

* changelog

* Update trybuild tests

* Make sure fallbacks are still inherited for opaque services (#1540)

* Document nesting routers with different state

* fix leftover conflicts
2022-11-18 11:02:58 +00:00
David Pedersen
ba8e9c1b21
Add on_failed_upgrade callback to WebSocketUpgrade (#1539)
* Add `on_failed_upgrade` callback to `WebSocket`

Previously if upgrading a connection to a WebSocket connection failed
the background task would panic. There was no way to customize that so
users that might wanna report the error was out of luck.

Panicking also wasn't great because users might abort on panics which
would bring down the server.

* changelog

* Apply suggestions from code review

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

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-11-18 10:53:04 +00:00
David Pedersen
7090649377
Add fallback inheritance for nested routers (#1521)
* fallback inheritance

* cleanup

* changelog
2022-11-18 10:25:04 +00:00
David Pedersen
2e8a7e51a1
Fix Handler::with_state not working if request body was changed via layer (#1536)
Previously

```rust
handler.layer(RequestBodyLimitLayer::new(...)).with_state(...)
```

didn't work because we required the same request body all the way
through.
2022-11-18 11:00:52 +01:00
David Pedersen
b1f894a500 Fix unused import if compiling with default features 2022-11-18 00:22:11 +01:00
danielvschoor
c461f1d827
Add accept_unmasked_frames setting in WebSocketUpgrade (#1529)
* Add accept_unmasked_frames setting in WebSocketUpgrade

* Update CHANGELOG.md

* Apply suggestions from code review

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-11-15 09:02:12 +00:00
Taylor Everding
587435940b
Add more tests for the Allow header when returning 405 (#1526)
Refs: #1525, #733
2022-11-14 16:02:05 +01:00
BBaoVanC
370ad07e75
Remove debug_assert in matched_path (#1527) 2022-11-13 02:54:29 +00:00
Kirk Paradis
afa13006cf
Update link to rust on nails (#1524) 2022-11-12 14:45:18 +01:00
Jonas Platte
c3fa0b2a3e
Fix unused variable warning when developing using a nightly toolchain (#1520) 2022-11-10 12:41:16 +01:00
David Pedersen
74bbe80f8a
axum 0.6.0-rc.4 (#1518) 2022-11-09 13:49:47 +01:00
David Pedersen
028cac4a72
Fix compile error in release mode (#1517) 2022-11-09 13:36:10 +01:00
David Pedersen
1d6a96ee20 Remove references to *_with_state_arc functions from changelog
They were removed again before being released.
2022-11-09 09:27:37 +01:00
David Pedersen
e53c85c496 Minor changelog fixes 2022-11-09 09:20:09 +01:00
David Pedersen
e39d053d2f
New release candidates (#1514)
* New release candidates

* Update axum/Cargo.toml

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

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-11-09 09:01:47 +01:00
David Pedersen
9c804d506e Update changelog for axum-extra 2022-11-08 21:45:05 +01:00
David Pedersen
0e3f9d0938
Don't allow extracting MatchedPath in middleware for nested routes (#1462)
* Don't allow extracting `MatchedPath` for nested paths

* misc clean up

* Update docs

* changelog

* Apply suggestions from code review

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

* Add test for nested handler service

* change to `debug_assert`

* apply suggestions from review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-11-08 20:43:19 +00:00
David Pedersen
e0ef641e5f
Rework Form and Query rejections (#1496)
* Change `FailedToDeserializeQueryString` rejection for `Form`

Its now called `FailedToDeserializeForm`.

* changelog

* Make dedicate rejection type for axum-extra's `Form`

* update trybuild test

* Make dedicate rejection type for axum-extra's `Query`
2022-11-08 20:31:06 +00:00
Konstantin Kostiuk
8d6313afa0
Add example of static-file-server using serve dir with handler as service (#1501)
* add example of static-file-seriver using serve dit with handler as service

* update handle return type in example

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

* cargo fmt fix

* change error mapping

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-11-08 20:40:20 +01:00