Document useful information for posterity.
The hyper ecosystem has split functionality into multiple crates. Some functionality has migrated to new crates (-util).
axum = { version = "0.6.20", features = ["headers", "json", "original-uri"] } -> { version = "0.7.9", features = ["json", "original-uri"] } axum-extra = NEW -> { version = "0.9.6", features = [ "typed-header" ] } Note: Not sure if I need to enabled typed-header, check this later
http = "0.2.11" -> "1.1.0" http-body = "0.4.6" -> "1.0.1" http-body-util = NEW "0.1.2"
hyper = { version = "0.14.28", features = ["server", "client", "stream"] } -> hyper = { version = "1.5.1", features = ["full"] } hyper-util = NEW { version = "0.1.10", features = ["full"] }
A lot of types are changing. It's not always a 1:1 change, because the new versions of hyper/axum offer much more nuance. I've tried to apply the following changes consistently.
This is no longer a struct, but a trait with multiple implementations depending on the use case. I've applied the following principles.
In this case, I'm just using the axum::body::Body
type as a direct
replacement for hyper::Body
. I'm assuming that the axum folks know what
they are doing.
My default choice is http_body_util::combinators::UnsyncBoxBody
This is chosen because it is a trait object which represents any of the many
structs which implement hyper::body
. Unsync because the future Streams
which we use in the router are only Send, not Sync.
From an UnsyncBoxBody
we can easily convert to and from various useful
stream representations.
In 0.14 this struct was a good choice, however we found it difficult to work with as we started to connect futures streams back to axum responses.
We have replaced our use of hyper::Error
with axum::Error
.
This is a straightforward drop-in replacement because the Http server
has been moved out of the hyper
crate into hyper_util
and renamed.
HttpBody
no longer exists in hyper
. This could be replaced either by
http_body::Body
or axum::body::HttpBody
. The latter is a re-export of the
former.
I've gone with the former for now, since it is clearly a dependency on
http_body
rather than a dependency on axum
.
This is a straightforward drop-in replacement because the Name struct
has been moved out of the hyper
crate into hyper_util
.
This is a straightforward drop-in replacement because the HttpConnector struct
has been moved out of the hyper
crate into hyper_util
.
This is no longer required in hyper 1.0 conversion.
This is a straightforward drop-in replacement because the ::headers module
has been moved out of the axum
crate into axum-extra
.
Note: Not sure if axum-extra TypedHeader feature needs to be enabled for this to continue working. Enabled for now.
This function appears to be completely removed and no longer required. Just delete it from the code base.
This type has been moved to the http_body_util crate.
Drop in replacement as functionality migrated from hyper to axum Note: There may be a better way to do this in hyper 1.0, leave as this for now.
Body
is now a trait, so I think this needs to be converted to become a
BodyStream
. It may be that it should be a Full
, check later.
Body
is now a trait. Empty
is an implementation of the trait which is
empty.
The Client
has been moved to the hyper_util
crate.
Simply remove the generic argument
The transport module is no longer required, so we can remove it
Ported to new tower Retry logic.