Additional methods for FrozenClientRequest

This commit is contained in:
Dmitry Pypin 2019-08-28 14:05:20 -07:00
parent 85a0d0721c
commit d1fdebe437
1 changed files with 25 additions and 0 deletions

View File

@ -98,6 +98,11 @@ impl ClientRequest {
} }
self self
} }
/// Get HTTP URI of request
pub fn get_uri(&self) -> &Uri {
&self.head.uri
}
/// Set socket address of the server. /// Set socket address of the server.
/// ///
@ -115,6 +120,11 @@ impl ClientRequest {
self self
} }
/// Get HTTP method of this request
pub fn get_method(&self) -> &Method {
&self.head.method
}
#[doc(hidden)] #[doc(hidden)]
/// Set HTTP version of this request. /// Set HTTP version of this request.
/// ///
@ -561,6 +571,21 @@ pub struct FrozenClientRequest {
} }
impl FrozenClientRequest { impl FrozenClientRequest {
/// Get HTTP URI of request
pub fn get_uri(&self) -> &Uri {
&self.head.uri
}
/// Get HTTP method of this request
pub fn get_method(&self) -> &Method {
&self.head.method
}
/// Returns request's headers.
pub fn headers(&self) -> &HeaderMap {
&self.head.headers
}
/// Send body with optional extra headers. /// Send body with optional extra headers.
/// Extra headers will override corresponding existing headers in a frozen request. /// Extra headers will override corresponding existing headers in a frozen request.
pub fn send_body<B>( pub fn send_body<B>(