Commit Graph
371 Commits
Author SHA1 Message Date
David Pedersen 93ecabf449 Release axum and axum-macros (#1743) 2023-02-11 22:32:16 +01:00
David Pedersen 827140f0d7 Document gotchas with impl IntoResponse (#1736) 2023-02-07 21:28:00 +00:00
David Pedersen 6e6aa8f39e Don't use impl IntoResponse in readme 2023-02-07 17:57:28 +01:00
David Pedersen 4a5dc4391c Release axum and axum-macros (#1721) 2023-01-24 13:31:33 +01:00
David Pedersen 47be78e0b3 Use map_while (#1720) 2023-01-24 12:49:36 +01:00
David Pedersen 6ff6b36293 Release axum and axum-core (#1716) 2023-01-20 23:51:19 +01:00
David Pedersen 5b07296001 Add RawPathParams (#1713) 2023-01-20 20:37:01 +00:00
David Pedersen 96b7d78a3f Document required tokio features for example (#1715) 2023-01-20 20:26:40 +00:00
David Pedersen 7a52161826 Implement Clone and Service for Next (#1712) 2023-01-20 21:19:01 +01:00
Jonas Platte 7ecf8bd6cf Use implicit format-args captures where applicable (#1709) 2023-01-20 12:04:49 +01:00
David Pedersen 8c081c20ab Remove accidentally committed dbg!s 2023-01-20 10:14:49 +01:00
David Pedersen 1be25d9496 Add internal macro to make tests of nest easier to write (#1694) 2023-01-14 14:12:01 +00:00
David Pedersen 607a20dfac Support deserialize_any for Path (#1693) 2023-01-13 12:27:38 +00:00
David Pedersen 25a46fbe79 fixup changelog 2023-01-13 11:54:30 +01:00
valkyrie_pilotandDavid Pedersen e4c6d76bca Implement IntoResponse for [u8; N] and &'static [u8; N] (#1690)
Co-authored-by: David Pedersen <[email protected]>
2023-01-13 09:12:51 +00:00
David Pedersen e3aaeb3cb7 Release axum, axum-core, and axum-macros (#1688) 2023-01-09 13:54:49 +01:00
Austaras 6638b274db Update to base64 0.20 (#1641) 2023-01-08 15:21:24 +00:00
David Pedersen be9a8c0380 Document breaking changes related to nest (#1684) 2023-01-07 19:06:59 +01:00
David PedersenandJonas Platte 1aa357c879 Misc documentation improvements (#1647)
Co-authored-by: Jonas Platte <[email protected]>
2023-01-07 14:07:54 +01:00
Paolo Barbolini 211de92d24 Enable the runtime feature of hyper when using tokio (#1671) 2023-01-06 12:28:31 +01:00
Tobias Bieniek 2d8242b2c5 docs/middleware: Add missing Clone derive on MyLayer (#1649) 2023-01-05 10:47:38 +00:00
Liigo Zhuang 978ae63358 Update extract.md (#1653) 2022-12-19 08:44:03 +01:00
Jonas Platte b372244099 Guide people to the right places to ask questions (#1631)
* README: Link to discussions instead of issues in Getting Help section

* Link to Discussions and Discord on new issue page
2022-12-09 10:14:31 +01:00
Mario Kaufmann e3d8868f99 Minor doc fixes (#1622) 2022-12-06 21:46:35 +00:00
David Pedersen 7e13d69639 Add status and body_text methods to built-in rejections (#1612)
* Add `status` and `body_text` methods to built-in rejections

This should make it easier to customize a built-in rejection while
preserving either the status or body.

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

* changelog
2022-12-02 19:54:16 +01:00
Cemre Mengu 5826ca268c Add missing import of http in docs example (#1613) 2022-12-02 14:47:04 +00:00
tottoto 56d0dd9ec2 Update to tokio-tungstenite-0.18.0 and use sha1 (#1598) 2022-12-02 11:13:57 +01:00
tottoto dd4e141f4c Remove outdated link alias from readme (#1591) 2022-11-29 11:51:44 +01: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
David Pedersen b984fec572 Remove notice about breaking changes from readme 2022-11-25 22:42:35 +01:00
David PedersenandJonas Platte 1b6780cf6c axum 0.6 and friends 🎉 (#1570)
* changelog

* bump versions

* reorder changelogs a bit

* Apply suggestions from code review

Co-authored-by: Jonas Platte <[email protected]>

* Expand fallback inheritance

* Reword tsr

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

Co-authored-by: Jonas Platte <[email protected]>
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
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
Tshepang Mbambo 3ab3e5f91d Use http re-export in docs (#1554) 2022-11-20 21:48:41 +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
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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: David Pedersen <[email protected]>
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 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 PedersenandJonas Platte 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 <[email protected]>

Co-authored-by: Jonas Platte <[email protected]>
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
danielvschoorandDavid Pedersen 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 <[email protected]>
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