mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-06 22:37:39 +03:00
simplify http response construction; deprecate httpcodes
This commit is contained in:
parent
8d8f6bedad
commit
44e3df82f6
58 changed files with 561 additions and 539 deletions
|
@ -7,9 +7,7 @@ extern crate actix_web;
|
|||
extern crate env_logger;
|
||||
|
||||
use std::env;
|
||||
use actix_web::{
|
||||
http, middleware, server,
|
||||
Application};
|
||||
use actix_web::{http, middleware, server, Application};
|
||||
|
||||
mod user;
|
||||
use user::info;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use actix_web::*;
|
||||
use actix_web::{Error, HttpMessage, HttpResponse, HttpRequest};
|
||||
use futures::Future;
|
||||
|
||||
|
||||
|
@ -14,6 +14,6 @@ pub fn info(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
|
|||
req.json()
|
||||
.from_err()
|
||||
.and_then(|res: Info| {
|
||||
Ok(httpcodes::HttpOk.build().json(res)?)
|
||||
Ok(HttpResponse::Ok().json(res))
|
||||
}).responder()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue