1
0
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:
Nikolay Kim
2017-10-29 06:05:31 -07:00
parent 5cd25cc8b1
commit af1e0bac08
7 changed files with 156 additions and 50 deletions

View File

@@ -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();