mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
allow to use fn with multiple arguments with .with()/.with_async()
This commit is contained in:
@ -208,7 +208,7 @@ fn test_form_extractor2() {
|
||||
r.route().with_config(
|
||||
|form: Form<FormData>| format!("{}", form.username),
|
||||
|cfg| {
|
||||
cfg.error_handler(|err, _| {
|
||||
cfg.0.error_handler(|err, _| {
|
||||
error::InternalError::from_response(
|
||||
err,
|
||||
HttpResponse::Conflict().finish(),
|
||||
@ -423,7 +423,7 @@ fn test_path_and_query_extractor2_async3() {
|
||||
let mut srv = test::TestServer::new(|app| {
|
||||
app.resource("/{username}/index.html", |r| {
|
||||
r.route().with(
|
||||
|(data, p, _q): (Json<Value>, Path<PParam>, Query<PParam>)| {
|
||||
|data: Json<Value>, p: Path<PParam>, _: Query<PParam>| {
|
||||
Delay::new(Instant::now() + Duration::from_millis(10))
|
||||
.and_then(move |_| {
|
||||
Ok(format!("Welcome {} - {}!", p.username, data.0))
|
||||
|
@ -13,8 +13,8 @@ extern crate tokio_reactor;
|
||||
extern crate tokio_tcp;
|
||||
|
||||
use std::io::{Read, Write};
|
||||
use std::sync::{mpsc, Arc};
|
||||
use std::{net, thread, time};
|
||||
use std::sync::Arc;
|
||||
use std::{thread, time};
|
||||
|
||||
#[cfg(feature = "brotli")]
|
||||
use brotli2::write::{BrotliDecoder, BrotliEncoder};
|
||||
@ -32,7 +32,6 @@ use tokio::executor::current_thread;
|
||||
use tokio::runtime::current_thread::Runtime;
|
||||
use tokio_tcp::TcpStream;
|
||||
|
||||
use actix::System;
|
||||
use actix_web::*;
|
||||
|
||||
const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
|
||||
@ -60,11 +59,13 @@ const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_start() {
|
||||
use std::{mpsc, net};
|
||||
|
||||
let _ = test::TestServer::unused_addr();
|
||||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
thread::spawn(|| {
|
||||
System::run(move || {
|
||||
actix::System::run(move || {
|
||||
let srv = server::new(|| {
|
||||
vec![App::new().resource("/", |r| {
|
||||
r.method(http::Method::GET).f(|_| HttpResponse::Ok())
|
||||
|
Reference in New Issue
Block a user