use header::CONTENT_TYPE

This commit is contained in:
Dietmar Maurer 2018-11-11 12:55:30 +01:00
parent ef1f0e655a
commit 3cdec2a010
1 changed files with 2 additions and 1 deletions

View File

@ -21,6 +21,7 @@ use hyper::http::request::Parts;
use hyper::{Method, Body, Request, Response, Server, StatusCode}; use hyper::{Method, Body, Request, Response, Server, StatusCode};
use hyper::rt::{Future, Stream}; use hyper::rt::{Future, Stream};
use hyper::service::service_fn; use hyper::service::service_fn;
use hyper::header;
use futures::future::*; use futures::future::*;
@ -144,7 +145,7 @@ fn handle_sync_api_request<'a>(
Ok(Response::builder() Ok(Response::builder()
.status(StatusCode::OK) .status(StatusCode::OK)
.header("ContentType", "application/json") .header(header::CONTENT_TYPE, "application/json")
.body(Body::from(json_str))?) .body(Body::from(json_str))?)
} }
Err(err) => Ok(error_response!(BAD_REQUEST, err.to_string())) Err(err) => Ok(error_response!(BAD_REQUEST, err.to_string()))