mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
allow to override request's uri
This commit is contained in:
parent
5eb3f1154e
commit
e9bbde6832
@ -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 New Issue
Block a user