mirror of
https://github.com/actix/actix-web.git
synced 2024-11-20 08:31:09 +00:00
allow to override request's uri
This commit is contained in:
parent
5eb3f1154e
commit
e9bbde6832
2 changed files with 19 additions and 11 deletions
|
@ -15,6 +15,8 @@
|
|||
|
||||
### Changed
|
||||
|
||||
* Allow to override request's uri
|
||||
|
||||
* Export `ws` sub-module with websockets related types
|
||||
|
||||
|
||||
|
|
|
@ -73,25 +73,31 @@ impl ClientRequest {
|
|||
where
|
||||
Uri: HttpTryFrom<U>,
|
||||
{
|
||||
let mut err = None;
|
||||
let mut head = RequestHead::default();
|
||||
head.method = method;
|
||||
|
||||
match Uri::try_from(uri) {
|
||||
Ok(uri) => head.uri = uri,
|
||||
Err(e) => err = Some(e.into()),
|
||||
}
|
||||
|
||||
ClientRequest {
|
||||
head,
|
||||
err,
|
||||
config,
|
||||
head: RequestHead::default(),
|
||||
err: None,
|
||||
#[cfg(feature = "cookies")]
|
||||
cookies: None,
|
||||
timeout: None,
|
||||
default_headers: true,
|
||||
response_decompress: true,
|
||||
}
|
||||
.method(method)
|
||||
.uri(uri)
|
||||
}
|
||||
|
||||
/// Set HTTP URI of request.
|
||||
#[inline]
|
||||
pub fn uri<U>(mut self, uri: U) -> Self
|
||||
where
|
||||
Uri: HttpTryFrom<U>,
|
||||
{
|
||||
match Uri::try_from(uri) {
|
||||
Ok(uri) => self.head.uri = uri,
|
||||
Err(e) => self.err = Some(e.into()),
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Set HTTP method of this request.
|
||||
|
|
Loading…
Reference in a new issue