simplify http response construction; deprecate httpcodes

This commit is contained in:
Nikolay Kim 2018-03-30 23:07:33 -07:00
parent 8d8f6bedad
commit 44e3df82f6
58 changed files with 561 additions and 539 deletions

View file

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

View file

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