mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-26 18:37:41 +02:00
simplify http response construction; deprecate httpcodes
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user