Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an implementation for RequestBuilder::from_parts and RequestBuilder::build_split for wasm targets #2268

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/wasm/request.rs
Original file line number Diff line number Diff line change
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