1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-02 13:29:24 +00: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>) {