mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-22 13:45:13 +02:00
add HttpContext::drain()
This commit is contained in:
@@ -13,7 +13,7 @@ use payload::Payload;
|
||||
use context::HttpContext;
|
||||
use httprequest::HttpRequest;
|
||||
use httpresponse::HttpResponse;
|
||||
use httpcodes::HTTPMethodNotAllowed;
|
||||
use httpcodes::{HTTPNotFound, HTTPMethodNotAllowed};
|
||||
|
||||
/// Http resource
|
||||
///
|
||||
@@ -51,6 +51,14 @@ impl<S> Default for Resource<S> {
|
||||
|
||||
impl<S> Resource<S> where S: 'static {
|
||||
|
||||
pub(crate) fn default_not_found() -> Self {
|
||||
Resource {
|
||||
name: String::new(),
|
||||
state: PhantomData,
|
||||
routes: HashMap::new(),
|
||||
default: Box::new(HTTPNotFound)}
|
||||
}
|
||||
|
||||
/// Set resource name
|
||||
pub fn set_name<T: ToString>(&mut self, name: T) {
|
||||
self.name = name.to_string();
|
||||
|
Reference in New Issue
Block a user