1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00
This commit is contained in:
Rob Ede 2023-03-14 02:36:22 +00:00
parent fd7d4c8a23
commit 0c820844c8
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 316 additions and 324 deletions

630
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,7 @@ async fn handle_post_3(req: HttpRequest, params: web::Form<MyParams>) -> impl Re
mod tests { mod tests {
use actix_web::{ use actix_web::{
body::to_bytes, body::to_bytes,
dev::{Service, ServiceResponse}, dev::ServiceResponse,
http::{ http::{
header::{HeaderValue, CONTENT_TYPE}, header::{HeaderValue, CONTENT_TYPE},
StatusCode, StatusCode,
@ -115,7 +115,7 @@ mod tests {
let app = test::init_service(App::new().configure(app_config)).await; let app = test::init_service(App::new().configure(app_config)).await;
let req = test::TestRequest::post() let req = test::TestRequest::post()
.uri("/post1") .uri("/post1")
.set_form(&MyParams { .set_form(MyParams {
name: "John".to_string(), name: "John".to_string(),
}) })
.to_request(); .to_request();
@ -160,7 +160,7 @@ mod tests {
let app = test::init_service(App::new().configure(app_config)).await; let app = test::init_service(App::new().configure(app_config)).await;
let req = test::TestRequest::post() let req = test::TestRequest::post()
.uri("/post2") .uri("/post2")
.set_form(&MyParams { .set_form(MyParams {
name: "John".to_string(), name: "John".to_string(),
}) })
.to_request(); .to_request();
@ -204,7 +204,7 @@ mod tests {
let app = test::init_service(App::new().configure(app_config)).await; let app = test::init_service(App::new().configure(app_config)).await;
let req = test::TestRequest::post() let req = test::TestRequest::post()
.uri("/post3") .uri("/post3")
.set_form(&MyParams { .set_form(MyParams {
name: "John".to_string(), name: "John".to_string(),
}) })
.to_request(); .to_request();

View File

@ -96,7 +96,7 @@ mod tests {
let req = test::TestRequest::post() let req = test::TestRequest::post()
.uri("/") .uri("/")
.set_json(&MyObj { .set_json(MyObj {
name: "my-name".to_owned(), name: "my-name".to_owned(),
number: 43, number: 43,
}) })