I was doing a coding exercise and realized that both surf::RequestBuilder and tide::ResponseBuilder didn't have body shorthand methods yet. This makes it so surf::RequestBuilder is closer to surf::Request, making it easier to write. Thanks!
Example
let uri = "https://httpbin.org/post";
let data = &Ip { ip: "129.0.0.1".into() };
// before
let res = surf::post(uri).body(Body::from_json(data)?).await?;
// after
let res = surf::post(uri).body_json(data)?.await?;
I was doing a coding exercise and realized that both
surf::RequestBuilder
andtide::ResponseBuilder
didn't have body shorthand methods yet. This makes it sosurf::RequestBuilder
is closer tosurf::Request
, making it easier to write. Thanks!Example