mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-05-10 00:20:43 +00:00
Custom HTTP Headers
This commit is contained in:
parent
28ae4dfdee
commit
31f92c07cd
18 changed files with 475 additions and 416 deletions
|
@ -1,5 +1,5 @@
|
|||
use super::SECURITY_NAME;
|
||||
use crate::{result::*, EndpointWithSchema, OpenapiSchema, RequestBody};
|
||||
use crate::{response::OrAllTypes, EndpointWithSchema, IntoResponse, OpenapiSchema, RequestBody, ResponseSchema};
|
||||
use indexmap::IndexMap;
|
||||
use mime::Mime;
|
||||
use openapiv3::{
|
||||
|
@ -184,11 +184,12 @@ impl OperationDescription {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::{NoContent, Raw, ResponseSchema};
|
||||
|
||||
#[test]
|
||||
fn no_content_schema_to_content() {
|
||||
let types = NoContent::accepted_types();
|
||||
let schema = <NoContent as ResourceResultSchema>::schema();
|
||||
let schema = <NoContent as ResponseSchema>::schema();
|
||||
let content = OperationDescription::schema_to_content(types.or_all_types(), Item(schema.into_schema()));
|
||||
assert!(content.is_empty());
|
||||
}
|
||||
|
@ -196,7 +197,7 @@ mod test {
|
|||
#[test]
|
||||
fn raw_schema_to_content() {
|
||||
let types = Raw::<&str>::accepted_types();
|
||||
let schema = <Raw<&str> as ResourceResultSchema>::schema();
|
||||
let schema = <Raw<&str> as ResponseSchema>::schema();
|
||||
let content = OperationDescription::schema_to_content(types.or_all_types(), Item(schema.into_schema()));
|
||||
assert_eq!(content.len(), 1);
|
||||
let json = serde_json::to_string(&content.values().nth(0).unwrap()).unwrap();
|
||||
|
|
|
@ -3,7 +3,7 @@ use super::{
|
|||
handler::{OpenapiHandler, SwaggerUiHandler},
|
||||
operation::OperationDescription
|
||||
};
|
||||
use crate::{routing::*, EndpointWithSchema, OpenapiType, ResourceResultSchema, ResourceWithSchema};
|
||||
use crate::{routing::*, EndpointWithSchema, OpenapiType, ResourceWithSchema, ResponseSchema};
|
||||
use gotham::{hyper::Method, pipeline::chain::PipelineHandleChain, router::builder::*};
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::{Captures, Regex};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue