1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +02:00

Add set_json method to TestRequest (#851)

- Takes a type which implements serde::Serialize, serializes it to JSON,
and sets it as the payload. The content-type is also set to JSON.
This commit is contained in:
Harry Stern
2019-05-18 22:36:28 -04:00
committed by Nikolay Kim
parent 8ff56d7cd5
commit 5826f39dbe
2 changed files with 36 additions and 1 deletions

View File

@ -6,6 +6,8 @@
* Add `Query<T>::from_query()` to extract parameters from a query string. #846
* `QueryConfig`, similar to `JsonConfig` for customizing error handling of query extractors.
* Add `test::TestRequest::set_json` convenience method to automatically
serialize data and set header in test requests.
### Changes