mirror of https://github.com/fafhrd91/actix-web
Add request and payload getters to ServiceRequest
This commit is contained in:
parent
f462aaa7b6
commit
06ebab09ee
|
@ -7,7 +7,7 @@ use std::sync::Arc;
|
|||
|
||||
use actix_http::HttpService;
|
||||
use actix_http_test::test_server;
|
||||
use actix_service::{map_config, fn_service, ServiceFactoryExt};
|
||||
use actix_service::{fn_service, map_config, ServiceFactoryExt};
|
||||
use actix_utils::future::ok;
|
||||
use actix_web::http::Version;
|
||||
use actix_web::{dev::AppConfig, web, App, HttpResponse};
|
||||
|
|
|
@ -99,6 +99,18 @@ impl ServiceRequest {
|
|||
}
|
||||
}
|
||||
|
||||
/// This method returns reference to the request
|
||||
#[inline]
|
||||
pub fn request(&self) -> &HttpRequest {
|
||||
&self.req
|
||||
}
|
||||
|
||||
/// This method returns reference to the payload
|
||||
#[inline]
|
||||
pub fn payload(&self) -> &Payload {
|
||||
&self.payload
|
||||
}
|
||||
|
||||
/// Create service response
|
||||
#[inline]
|
||||
pub fn into_response<B, R: Into<Response<B>>>(self, res: R) -> ServiceResponse<B> {
|
||||
|
|
Loading…
Reference in New Issue