Skip to content

Commit

Permalink
wasm: Add an implementation for RequestBuilder::from_parts and Reques…
Browse files Browse the repository at this point in the history
…tBuilder::build_split for wasm targets (#2268)
  • Loading branch information
nickguletskii committed Apr 30, 2024
1 parent 81c0399 commit 210c8a0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/wasm/request.rs
Expand Up @@ -115,6 +115,14 @@ impl RequestBuilder {
RequestBuilder { client, request }
}

/// Assemble a builder starting from an existing `Client` and a `Request`.
pub fn from_parts(client: crate::Client, request: crate::Request) -> crate::RequestBuilder {
crate::RequestBuilder {
client,
request: crate::Result::Ok(request),
}
}

/// Modify the query string of the URL.
///
/// Modifies the URL of this request, adding the parameters provided.
Expand Down Expand Up @@ -349,6 +357,15 @@ impl RequestBuilder {
self.request
}

/// Build a `Request`, which can be inspected, modified and executed with
/// `Client::execute()`.
///
/// This is similar to [`RequestBuilder::build()`], but also returns the
/// embedded `Client`.
pub fn build_split(self) -> (Client, crate::Result<Request>) {
(self.client, self.request)
}

/// Constructs the Request and sends it to the target URL, returning a
/// future Response.
///
Expand Down

0 comments on commit 210c8a0

Please sign in to comment.