Skip to content

Commit

Permalink
Added getters to RequestBuilder.
Browse files Browse the repository at this point in the history
  • Loading branch information
theduke committed May 8, 2017
1 parent b0ef498 commit f531960
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ pub struct RequestBuilder {
}

impl RequestBuilder {

/// Get the url result.
///
/// Will contain an error if the given URL was invalid.
pub fn get_url(&self) -> &Result<Url, ::UrlError> {
&self.url
}

/// Add a `Header` to this Request.
///
/// ```no_run
Expand All @@ -175,12 +183,22 @@ impl RequestBuilder {
self
}

/// Get the headers.
pub fn get_headers(&self) -> &::header::Headers {
&self.headers
}

/// Set the request body.
pub fn body<T: Into<Body>>(mut self, body: T) -> RequestBuilder {
self.body = Some(Ok(body.into()));
self
}

/// Get the body.
pub fn get_body(&self) -> Option<&::Result<Body>> {
self.body.as_ref()
}

/// Send a form body.
///
/// Sets the body to the url encoded serialization of the passed value,
Expand Down

0 comments on commit f531960

Please sign in to comment.