1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 17:07:01 +02:00

use actix_web::Error for middleware errors

This commit is contained in:
Nikolay Kim
2019-03-10 16:35:38 -07:00
parent 79875ea039
commit 4d96abb639
13 changed files with 305 additions and 85 deletions

View File

@@ -14,9 +14,9 @@ use bytes::Bytes;
use futures::Future;
use crate::config::{AppConfig, AppConfigInner};
use crate::request::HttpRequest;
use crate::rmap::ResourceMap;
use crate::service::{ServiceFromRequest, ServiceRequest, ServiceResponse};
use crate::{HttpRequest, HttpResponse};
thread_local! {
static RT: RefCell<Runtime> = {
@@ -277,6 +277,11 @@ impl TestRequest {
self.req.finish()
}
/// Complete request creation and generate `ServiceResponse` instance
pub fn to_response<B>(self, res: HttpResponse<B>) -> ServiceResponse<B> {
self.to_service().into_response(res)
}
/// Complete request creation and generate `HttpRequest` instance
pub fn to_http_request(mut self) -> HttpRequest {
let req = self.req.finish();