forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/3.4.x' into 4.0.x
This commit is contained in:
@@ -19,7 +19,9 @@ use tokio_core::reactor;
|
||||
#[allow(unused_imports)]
|
||||
use rust_server_test::{ApiNoContext, ContextWrapperExt,
|
||||
ApiError,
|
||||
DummyGetResponse
|
||||
DummyGetResponse,
|
||||
DummyPutResponse,
|
||||
HtmlPostResponse
|
||||
};
|
||||
use clap::{App, Arg};
|
||||
|
||||
@@ -29,6 +31,8 @@ fn main() {
|
||||
.help("Sets the operation to run")
|
||||
.possible_values(&[
|
||||
"DummyGet",
|
||||
"DummyPut",
|
||||
"HtmlPost",
|
||||
])
|
||||
.required(true)
|
||||
.index(1))
|
||||
@@ -74,6 +78,16 @@ fn main() {
|
||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||
},
|
||||
|
||||
Some("DummyPut") => {
|
||||
let result = core.run(client.dummy_put(None));
|
||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||
},
|
||||
|
||||
Some("HtmlPost") => {
|
||||
let result = core.run(client.html_post("body_example".to_string()));
|
||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||
},
|
||||
|
||||
_ => {
|
||||
panic!("Invalid operation provided")
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ use swagger;
|
||||
use swagger::{Has, XSpanIdString};
|
||||
|
||||
use rust_server_test::{Api, ApiError,
|
||||
DummyGetResponse
|
||||
DummyGetResponse,
|
||||
DummyPutResponse,
|
||||
HtmlPostResponse
|
||||
};
|
||||
use rust_server_test::models;
|
||||
|
||||
@@ -35,4 +37,18 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn dummy_put(&self, inline_object: Option<models::InlineObject>, context: &C) -> Box<Future<Item=DummyPutResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("dummy_put({:?}) - X-Span-ID: {:?}", inline_object, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
/// Test HTML handling
|
||||
fn html_post(&self, body: String, context: &C) -> Box<Future<Item=HtmlPostResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("html_post(\"{}\") - X-Span-ID: {:?}", body, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user