* 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>
* 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.
* Change `HeaderMap` extractor to clone the headers
* fix docs
* changelog
* inline variable
* also add changelog item to axum
* don't list types from axum in axum-core's changelog
* document that `HeaderMap::from_request` clones the headers
* fix typo
* a few more typos
* Use 308 status instead of 301 when redirecting
For redirects resulting from requests to paths with a trailing slash,
use 308 instead of 301 to prevent non-GET requests (POST, PUT, etc) from
being changed to GET.
For example, (assuming a route for /path is defined)...
- Old behavior results in:
POST /path/ -> GET /path
- New behavior results in:
POST /path/ -> POST /path
Fixes#681
* Add deprecation notice to found()
Deprecates found() due to its use of HTTP 302
* rustfmt
* Use dedicated redirect method
Use Redirect::permanent instead of re-implementing its functionality
* Remove deprecated method from example
Replace usages of Redirect:found with Redirect::to and Redirect::temporary as appropriate
* Fix panic in oauth example
Previously the example would panic if a request was made without the
`Cookie` header. Now the user is redirected to the login page as
expected.
* Update CHANGELOG
* Revert pub TypedheaderRejection fields
* Fix clippy lint
* cargo fmt
* Fix CHANGELOG link
* Adhere to implicit line length limit
* Simplify json content-type check
* Import HeaderMap from http instead of from headers
The headers crate is an optional dependency and its HeaderMap re-export
is `#[doc(hidden)]`.
* Use headers re-export in axum in examples
* Add `middleware::from_fn` for creating middleware from async fns
* More trait impls for `Next`
* Make `Next::run` consume `self`
* Use `.router_layer` in example, since middleware returns early
* Actually `Next` probably shouldn't impl `Clone` and `Service`
Has implications for backpressure and stuff
* Simplify `print-request-response` example
* Address review feedback
* add changelog link
* Provide more error in `Path` deserialization error
* Rename
* Add error kind for deserializing sequences
* Rename
* Fix wrong docs
* Rename `MissingRouteParams`
* Rename error to have more consistency
* Rename internal error
* Update changelog
* One last renaming, for now
* Add tests
* Tweak changelog a bit
* Move `IntoResponse` to axum-core
* Move `FromRequest` to axum-core
* some clean up
* Remove hyper dependency from axum-core
* Fix docs reference
* Use default
* Update changelog
* Remove mention of default type
* Move `axum-handle-error-extract` into axum
With 0.4 underway we can now nuke `axum-handle-error-extract` and move
its code directly into axum.
So this replaces the old `HandleErrorLayer` with one that supports async
functions and extractors.
* changelog
* fix CI
* Empty crate
* basic setup
* Support `HEAD`
* Add remaining methods
* Impl Debug
* Add `MethodRouter::merge`
* WIP
* Support same route with different methods in different calls
* Update changelog
* Bring back `any` and `any_service`
* Address review feedback
* Move axum crate into workspace subfolder
Over time I imagine we're gonna have other crates in this repo that
provide utilities or integrations for axum. This prepares for that by
moving the main axum crate into its own folder.
The README situation is a bit annoying because we want `./README.md`
for viewing the repo on github but `axum/README.md` for crates.io. For
now I've just copy/pasted it and added CI step to make sure they're
identical.
* update changelog link
* Add licenses to all examples
* is this how you install `diff`?
* or maybe this is how?
* fix readme links
* like this?
* fix cargo-deny step
* Try making root readme a symlink
* remove compare readme step
not needed since readme in repo root is now a symlink
* Revert "Add licenses to all examples"
This reverts commit ab321b7fb9.
* Add project based on the readme example
* Add readme project link to README.md
* Typo correction
* Update examples/readme-example/Cargo.toml
Use tracing-subscriber 0.2 to match other the other examples
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
* Update README.md
Use original readme phrasing for crate docs
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
* Rename readme-exmaple to readme
* Revert tracing call to debug from info
Co-authored-by: Jordan Gould <jordan@tineye.com>
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
This reworks axum's docs in an attempt to make things easier to find. Previously I wasn't a fan of those docs for the same topic were spread across the root module docs and more specific places like types and methods.
This changes it such that the root module docs only gives a high level introduction to a topic, perhaps with a small example, and then link to other places where all the details are. This means `Router` is now the single place to learn about routing, and etc for the topics like handlers and error handling.