Skip to content

Releases: cloudwego/volo

Volo-HTTP 0.3.0

28 Nov 12:38
661346b
Compare
Choose a tag to compare

What's Changed

Notable Changes

Since Volo-HTTP 0.2.14

  • Server side
    • Support MultiPart #511
  • Client Side
    • Use less Result in client #509
    • Support CookieJar #512
    • Refactor ClientBuilder, Target and CallOpt #528
  • Generic
    • Wrap hyper::body::Incoming by Body #504

Bugfix

  • Fixed the issue where the Form was rejected due to incorrect judgment #538
  • Fixed an issue where DNS resolution would always prefer IPv4 addresses #538

Break Changes

Adjust positions of some mods #499

Because the positions of the modules were confusing before, we adjusted the positions of some modules for a better user experience.

  • volo_http::json::Json -> volo_http::server::extract::Json
  • volo_http::extension::Extension -> volo_http::utils::Extension
  • volo_http::cookie::CookieJar -> volo_http::utils::cookie::CookieJar

In addition, Json and Extension were not be re-exported in volo_http, user should import them by its full path.

All Bodys (http_body::Body) are unified into volo_http::body::Body #504

For a more unified experience, we wrap hyper::body::Incoming by volo_http::body::Body, and default generic types of Router, MethodRouter, Route and FromRequest have been updated from Incoming to Body.

And because Body is unified, ClientRequest and ServerRequest are unified into Request, and ClientResponse and ServerResponse are unified into Response. Currently XxxRequest and XxxResponse are not removed, but marked as deprecated.

If you are using Router (and MethodRouter, Route) and specify Incoming as its generic type, update it to Body or remove the generic type directly.

If you implemented FromRequest without use generic type (use default generic type), the argument type should be updated.

If you used ServerRequest and ClientRequest, replace it to Request. If you used ServerResponse and ClientResponse, replace it to Response.

// old
let _: Router<Incoming> = Router::new().route(...);

// new
let _: Router<Body> = Router::new().route(...);
// or remove generic type
let _: Router = Router::new().route(...);
// old
impl FromRequest for Foo {
    type Rejection = ...;
    async fn from_request(
        cx: &mut ServerContext,
        parts: Parts,
        body: Incoming,
    ) -> Result<Self, Self::Rejection> {
    }
}

// new
impl FromRequest for Foo {
    type Rejection = ...;
    async fn from_request(
        cx: &mut ServerContext,
        parts: Parts,
        body: Body,
    ) -> Result<Self, Self::Rejection> {
    }
}

// or use generic type B
impl<B> FromRequest<B> for Foo
where
    B: Body + Send,
    B::Data: Send,
    B::Error: Send,
{
    type Rejection = ...;
    async fn from_request(
        cx: &mut ServerContext,
        parts: Parts,
        body: B,
    ) -> Result<Self, Self::Rejection> {
    }
}

Most client methods no longer return Result #509

For a better user experience, we changed the return value of some methods of client that originally returned Result<Self> to Self.

In other words, chain calls can be used fluently without adding unwrap, expect or ? in between, they can be removed.

// old
let _ = client.get("http://example.com/").unwrap().send().await;

// new
let _ = client.get("http://example.com/").send().await;

Refactor ClientBuilder, Target and CallOpt #522 #528

In order to make the service function more independent, and unify the user experience of Volo-Thrift, Volo-gRPC and Volo-HTTP, while retaining the characteristics of Volo-HTTP, we refactored ClientBuilder, Target and CallOpt.

  • ClientBuilder::caller_name and ClientBuilder::callee_name are renamed to ClientBuilder::user_agent and ClientBuilder::default_host
  • ClientBuilder::fail_on_status has been removed, you should use FailOnStatus layer instead
  • RequestBuilder::set_request_timeout has been removed, users should use RequestBuilder::with_callopt and CallOpt::new().with_timeout(...) instead
// old
let mut builder= ClientBuilder::new();
builder.caller_name(...).callee_name(...).fail_on_status(...);
let client = builder.build();
client.get(...).set_request_timeout(...).send().await;

// new
let mut builder= ClientBuilder::new();
builder.user_agent(...).default_host(...).layer_outer(FailOnStatus::xxx());
let client = builder.build();
client.get(...).with_callopt(CallOpt::new().with_timeout(...)).send().await;

And if you are using customized service discover, you should also pay attention to the following changes:

  • TargetParser has been removed, you should implement volo::client::Apply for your service discover

Detailed Pull Requests

Full Changelog: volo-http-0.2.14...volo-http-0.3.0

Volo-HTTP 0.3.0-rc.3

12 Nov 08:07
2191a43
Compare
Choose a tag to compare
Volo-HTTP 0.3.0-rc.3 Pre-release
Pre-release

What's Changed

  • fix(volo-http): fix wrong rule of setting header Host by @yukiiiteru in #532

Full Changelog: volo-http-0.3.0-rc.2...volo-http-0.3.0-rc.3

Volo-HTTP 0.3.0-rc.2

12 Nov 03:36
b7cd407
Compare
Choose a tag to compare
Volo-HTTP 0.3.0-rc.2 Pre-release
Pre-release

What's Changed

  • ClientBuilder, Target and CallOpt have been refactored
  • Timeout and FailOnStatus now provided as Layers
  • Add feature json-utf8-lossy for using feature sonic-rs/utf8_lossy
  • chore(volo-http): add TimeoutLayer and FailOnStatus layer by @yukiiiteru in #522
  • chore(volo-http): refactor ClientBuilder, Target and CallOpt by @yukiiiteru in #528
  • chore(volo-http): add feature json-utf8-lossy by @yukiiiteru in #530
  • chore(volo-http): fix previously missed changes to Body by @yukiiiteru in #531

Full Changelog: volo-http-0.3.0-rc.1...volo-http-0.3.0-rc.2

Volo-Thrift 0.10.5

06 Nov 13:47
5d85c3d
Compare
Choose a tag to compare

What's Changed

Full Changelog: volo-thrift-0.10.4...volo-thrift-0.10.5

Volo-build 0.10.17

06 Nov 13:46
5d85c3d
Compare
Choose a tag to compare

What's Changed

Full Changelog: volo-build-0.10.14...volo-build-0.10.17

Volo-HTTP 0.3.0-rc.1

11 Nov 16:19
b59621f
Compare
Choose a tag to compare
Volo-HTTP 0.3.0-rc.1 Pre-release
Pre-release

What's Changed

  • Support MultiPart at server side
  • Support CookieLayer (a cookie jar) at client side
  • Add more test utilities for unit testing

Following is all pull requests of this version

Features

Others

Full Changelog: volo-http-0.2.14...volo-http-0.3.0-rc.1

Volo-Thrift 0.10.4

29 Aug 06:35
225090e
Compare
Choose a tag to compare

Volo-HTTP 0.2.14

29 Aug 06:38
225090e
Compare
Choose a tag to compare

What's Changed

  • fix(volo-http): append query for StripPrefixLayer by @yukiiiteru in #489
  • fix: faststr compile needs to enable serde feature && update dep to latest by @PureWhiteWu in #493

Full Changelog: volo-http-0.2.13...volo-http-0.2.14

Volo-gRPC 0.10.4

29 Aug 06:36
225090e
Compare
Choose a tag to compare
volo-grpc-0.10.4

fix: faststr compile needs to enable serde feature && update dep to l…

Volo-cli 0.10.3

29 Aug 06:37
225090e
Compare
Choose a tag to compare
volo-cli-0.10.3

fix: faststr compile needs to enable serde feature && update dep to l…