forked from loafle/openapi-generator-original
[rust-server] Always derive Debug (#1404)
* Add test for file response * Always derive Debug Now that we're using a byte array, we can guarantee that deriving Debug will always work
This commit is contained in:
@@ -21,6 +21,7 @@ use rust_server_test::{ApiNoContext, ContextWrapperExt,
|
||||
ApiError,
|
||||
DummyGetResponse,
|
||||
DummyPutResponse,
|
||||
FileResponseGetResponse,
|
||||
HtmlPostResponse
|
||||
};
|
||||
use clap::{App, Arg};
|
||||
@@ -32,6 +33,7 @@ fn main() {
|
||||
.possible_values(&[
|
||||
"DummyGet",
|
||||
"DummyPut",
|
||||
"FileResponseGet",
|
||||
"HtmlPost",
|
||||
])
|
||||
.required(true)
|
||||
@@ -83,6 +85,11 @@ fn main() {
|
||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||
},
|
||||
|
||||
Some("FileResponseGet") => {
|
||||
let result = core.run(client.file_response_get());
|
||||
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());
|
||||
|
||||
@@ -13,6 +13,7 @@ use swagger::{Has, XSpanIdString};
|
||||
use rust_server_test::{Api, ApiError,
|
||||
DummyGetResponse,
|
||||
DummyPutResponse,
|
||||
FileResponseGetResponse,
|
||||
HtmlPostResponse
|
||||
};
|
||||
use rust_server_test::models;
|
||||
@@ -44,6 +45,13 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
/// Get a file
|
||||
fn file_response_get(&self, context: &C) -> Box<Future<Item=FileResponseGetResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("file_response_get() - X-Span-ID: {:?}", 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();
|
||||
|
||||
Reference in New Issue
Block a user