mirror of https://github.com/fafhrd91/actix-web
test code in doc should compile now
This commit is contained in:
parent
d99629bdf2
commit
774a9d1e8b
|
@ -370,7 +370,7 @@ impl TestRequest {
|
||||||
/// This function blocks the current thread until futures complete.
|
/// This function blocks the current thread until futures complete.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use actix_web::{App, test};
|
/// use actix_web::{App, test, web, HttpResponse, http::header};
|
||||||
/// use serde::{Serialize, Deserialize};
|
/// use serde::{Serialize, Deserialize};
|
||||||
///
|
///
|
||||||
/// #[derive(Serialize, Deserialize)]
|
/// #[derive(Serialize, Deserialize)]
|
||||||
|
@ -380,7 +380,7 @@ impl TestRequest {
|
||||||
/// fn test_add_person() {
|
/// fn test_add_person() {
|
||||||
/// let mut app = test::init_service(App::new().service(
|
/// let mut app = test::init_service(App::new().service(
|
||||||
/// web::resource("/people")
|
/// web::resource("/people")
|
||||||
/// .route(web::post().to(|person: Json<Person>| {
|
/// .route(web::post().to(|person: web::Json<Person>| {
|
||||||
/// HttpResponse::Ok()
|
/// HttpResponse::Ok()
|
||||||
/// .json(person.into_inner())})
|
/// .json(person.into_inner())})
|
||||||
/// )));
|
/// )));
|
||||||
|
@ -393,7 +393,7 @@ impl TestRequest {
|
||||||
/// .set_payload(payload)
|
/// .set_payload(payload)
|
||||||
/// .to_request();
|
/// .to_request();
|
||||||
///
|
///
|
||||||
/// let result = test::read_response_json<_, _, _, Person>(&mut app, req);
|
/// let result = test::read_response_json::<_, _, _, Person>(&mut app, req);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn read_response_json<S, R, B, T>(app: &mut S, req: R) -> T
|
pub fn read_response_json<S, R, B, T>(app: &mut S, req: R) -> T
|
||||||
|
|
Loading…
Reference in New Issue