Commit graph

576 commits

Author SHA1 Message Date
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
David Pedersen
84df7eaa38 MethodRouter::fallback docs follow up
https://github.com/tokio-rs/axum/pull/733#discussion_r795244092
2022-01-31 09:37:29 +01:00
David Pedersen
513766b9e7
Set Allow header when returning 405 Method Not Allowed (#733) 2022-01-30 21:41:34 +01:00
David Pedersen
a04fc42d75
Rework middleware docs (#732)
* rework middleware docs

* Apply suggestions from code review

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

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-30 20:09:18 +01:00
David Pedersen
911c4a788e
Support opt-out of extra derived traits for rejections for #[derive(FromRequest)] (#729)
* Handle structs without fields

* Support opt-out of derived rejection traits

* Handle duplicate opt outs

* Improve error if opting out of `Display` or `Debug` but not `Error`

* document `rejection_derive`

* Handle using both `via` and `rejection_derive`

* don't derive debug for `RejectionDeriveOptOuts`

* Update axum-macros/src/from_request.rs

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

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-28 09:54:38 +00:00
David Pedersen
f6fc5ed80c
Move axum-debug into axum-macros (#724)
* Move axum-debug into axum-macros

* fix ref to axum-macros in changelog

* Apply suggestions from code review

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

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-26 23:27:22 +01:00
Alex
b1283e9708
Fix year for the 0.4.4 release (#727) 2022-01-26 08:17:39 +01:00
YuKun Liu
c0473f2b6f
Expand WebSocket example to match on Message (#723) 2022-01-25 15:31:33 +00:00
FlakM
32c9ab3c56
Add sqlx example with migrations (#722)
* Add sqlx example with migrations

Simple use case for sqlx based on tokio postgres example.
Sqlite database is created on execution in ./target directory
and migrations are then run against it.

* sqlx example uses postgres instead of sqlite3

Also removed migrations and database creation code.
2022-01-25 16:20:00 +01:00
David Pedersen
e4c389c94d
Add axum-macros crate with #[derive(FromRequest)] (#718)
* initial working impl

* support `#[from_request(via(...))]`

* support extracting the whole thing at once

* rely on type inference

* fix footgun

* fix typo

* generate rejection enums

* move tests to trybuild

* minor clean up

* docs

* Support multiple generic extractors with same "via" type

* support `Result` as well

* Update axum-macros/src/from_request.rs

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

* Add `#[automatically_derived]`

* remove needless `#[derive(Debug)]` on macro types

* Fix error messages that different for some reason

* Update axum-macros/src/lib.rs

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

* add more `#[automatically_derived]`

* support same types in tuple structs

* update docs

* prep axum-macros for release

* address review feedback

* Update axum-macros/src/lib.rs

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

* Update axum-macros/src/lib.rs

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

* Update known limitation

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-25 15:05:50 +01:00
David Pedersen
9004a14302
Move middleware::from_fn into axum (#719)
* Move `middleware::from_fn` into axum

* changelog

* fix feature

* Rephrase changelog a bit
2022-01-25 10:19:06 +01:00
David Pedersen
208720be53 Clarity Err usage in IntoResponseHeaders 2022-01-25 09:46:38 +01:00
David Pedersen
4f6e86f026 Fixup changelogs 2022-01-25 09:46:26 +01:00
David Pedersen
e7051322d3 Make IntoResponseHeaders members hidden 2022-01-23 20:25:12 +01:00
David Pedersen
2546be04f6 Clean up docs for IntoResponseHeaders 2022-01-23 20:25:12 +01:00
David Pedersen
f96111851d Remove mention of IntoResponseHeaders from axum-debug 2022-01-23 20:25:12 +01:00
David Pedersen
d4849820ce Move Headers into axum 2022-01-23 20:25:12 +01:00
Jonas Platte
bf83f34617 Add trait IntoResponseHeaders (#649)
* Introduce IntoResponseHeaders trait

* Implement IntoResponseHeaders for HeaderMap

* Add impl IntoResponse for impl IntoResponseHeaders

… and update IntoResponse impls that use HeaderMap to be generic instead.

* Add impl IntoResponseHeaders for Headers

… and remove IntoResponse impls that use it.

* axum-debug: Fix grammar in docs

* Explain confusing error message in docs
2022-01-23 18:01:52 +01:00
David Pedersen
b1ef0be1a7 Remove RequestParts::take_extensions (#699)
* Remove `RequestParts::take_extensions`

* fix out of date docs

* Remove RequestAlreadyExtracted and replace it with BodyAlreadyExtracted

* fix docs

* fix test

* Update axum-core/src/extract/mod.rs

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

* Remove macro only used once

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-23 18:01:52 +01:00