1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-05-10 00:20:43 +00:00

Reexports

This commit is contained in:
msrd0 2021-02-03 21:22:46 +00:00
parent 441a42c75e
commit af28e0d916
16 changed files with 50 additions and 34 deletions

View file

@ -1,9 +1,11 @@
use super::SECURITY_NAME;
use futures_util::{future, future::FutureExt};
use gotham::{
anyhow,
handler::{Handler, HandlerFuture, NewHandler},
helpers::http::response::create_response,
hyper::StatusCode,
state::State
};
use indexmap::IndexMap;
@ -75,7 +77,7 @@ impl Handler for OpenapiHandler {
Ok(openapi) => openapi,
Err(e) => {
error!("Unable to acquire read lock for the OpenAPI specification: {}", e);
let res = create_response(&state, crate::StatusCode::INTERNAL_SERVER_ERROR, TEXT_PLAIN, "");
let res = create_response(&state, StatusCode::INTERNAL_SERVER_ERROR, TEXT_PLAIN, "");
return future::ok((state, res)).boxed();
}
};
@ -88,12 +90,12 @@ impl Handler for OpenapiHandler {
match serde_json::to_string(&openapi) {
Ok(body) => {
let res = create_response(&state, crate::StatusCode::OK, APPLICATION_JSON, body);
let res = create_response(&state, StatusCode::OK, APPLICATION_JSON, body);
future::ok((state, res)).boxed()
},
Err(e) => {
error!("Unable to handle OpenAPI request due to error: {}", e);
let res = create_response(&state, crate::StatusCode::INTERNAL_SERVER_ERROR, TEXT_PLAIN, "");
let res = create_response(&state, StatusCode::INTERNAL_SERVER_ERROR, TEXT_PLAIN, "");
future::ok((state, res)).boxed()
}
}

View file

@ -78,7 +78,7 @@ impl OperationParams {
pub struct OperationDescription {
operation_id: Option<String>,
default_status: crate::StatusCode,
default_status: gotham::hyper::StatusCode,
accepted_types: Option<Vec<Mime>>,
schema: ReferenceOr<Schema>,
params: OperationParams,