1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

Add ServiceRequest::set_payload() method

This commit is contained in:
Nikolay Kim 2019-05-22 21:25:51 -07:00
parent babf48c550
commit ded1e86e7e
2 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,8 @@
### Add
* Add `ServiceRequest::set_payload()` method.
* Add `test::TestRequest::set_json()` convenience method to automatically
serialize data and set header in test requests.

View File

@ -189,6 +189,11 @@ impl ServiceRequest {
}
}
/// Set request payload.
pub fn set_payload(&mut self, payload: Payload) {
Rc::get_mut(&mut (self.0).0).unwrap().payload = payload;
}
#[doc(hidden)]
/// Set new app data container
pub fn set_data_container(&mut self, extensions: Rc<Extensions>) {