mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-27 23:45:53 +02:00
Add support for serde_json::Value to be passed as argument to ResponseBuilder.body() (#1096)
* Add support for serde_json::Value to be passed as argument to ResponseBuilder.body() * Update actix-http/CHANGES.md
This commit is contained in:
committed by
Nikolay Kim
parent
58c7065f08
commit
aa39b8ca6f
@@ -992,6 +992,14 @@ mod tests {
|
||||
assert_eq!(resp.body().get_ref(), b"[\"v1\",\"v2\",\"v3\"]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_serde_json_in_body() {
|
||||
use serde_json::json;
|
||||
let resp =
|
||||
Response::build(StatusCode::OK).body(json!({"test-key":"test-value"}));
|
||||
assert_eq!(resp.body().get_ref(), br#"{"test-key":"test-value"}"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_into_response() {
|
||||
let resp: Response = "test".into();
|
||||
|
Reference in New Issue
Block a user