From 806562bb059e2cd6fa7ac068568f6c6042f036b5 Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Mon, 23 Mar 2020 13:04:29 +0000 Subject: [PATCH] [Rust Server] Retire mimetypes modules (#5560) * Retire mimetypes module to prevent collision in mimetype identifiers * Update samples --- .../codegen/languages/RustServerCodegen.java | 1 - .../src/main/resources/rust-server/README.md | 3 - .../rust-server/client-imports.mustache | 1 - .../rust-server/client-operation.mustache | 6 +- .../main/resources/rust-server/lib.mustache | 3 - .../rust-server/mimetypes-request.mustache | 22 --- .../rust-server/mimetypes-response.mustache | 10 -- .../resources/rust-server/mimetypes.mustache | 39 ----- .../rust-server/server-imports.mustache | 1 - .../rust-server/server-operation.mustache | 2 +- .../output/multipart-v3/src/client/mod.rs | 5 +- .../output/multipart-v3/src/lib.rs | 3 - .../output/multipart-v3/src/mimetypes.rs | 17 -- .../output/multipart-v3/src/server/mod.rs | 1 - .../output/no-example-v3/src/client/mod.rs | 3 +- .../output/no-example-v3/src/lib.rs | 3 - .../output/no-example-v3/src/mimetypes.rs | 11 -- .../output/no-example-v3/src/server/mod.rs | 1 - .../output/openapi-v3/src/client/callbacks.rs | 1 - .../output/openapi-v3/src/client/mod.rs | 15 +- .../rust-server/output/openapi-v3/src/lib.rs | 3 - .../output/openapi-v3/src/mimetypes.rs | 91 ----------- .../output/openapi-v3/src/server/callbacks.rs | 1 - .../output/openapi-v3/src/server/mod.rs | 29 ++-- .../output/ops-v3/src/client/mod.rs | 1 - .../rust-server/output/ops-v3/src/lib.rs | 3 - .../output/ops-v3/src/mimetypes.rs | 81 ---------- .../output/ops-v3/src/server/mod.rs | 1 - .../src/client/mod.rs | 41 +++-- .../src/lib.rs | 3 - .../src/mimetypes.rs | 149 ------------------ .../src/server/mod.rs | 33 ++-- .../output/rust-server-test/src/client/mod.rs | 9 +- .../output/rust-server-test/src/lib.rs | 3 - .../output/rust-server-test/src/mimetypes.rs | 43 ----- .../output/rust-server-test/src/server/mod.rs | 11 +- 36 files changed, 73 insertions(+), 577 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/rust-server/mimetypes-request.mustache delete mode 100644 modules/openapi-generator/src/main/resources/rust-server/mimetypes-response.mustache delete mode 100644 modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache delete mode 100644 samples/server/petstore/rust-server/output/multipart-v3/src/mimetypes.rs delete mode 100644 samples/server/petstore/rust-server/output/no-example-v3/src/mimetypes.rs delete mode 100644 samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs delete mode 100644 samples/server/petstore/rust-server/output/ops-v3/src/mimetypes.rs delete mode 100644 samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs delete mode 100644 samples/server/petstore/rust-server/output/rust-server-test/src/mimetypes.rs diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index b1d8fe360d6..bf735a6a6f2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -238,7 +238,6 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("context.mustache", "src", "context.rs")); supportingFiles.add(new SupportingFile("models.mustache", "src", "models.rs")); supportingFiles.add(new SupportingFile("header.mustache", "src", "header.rs")); - supportingFiles.add(new SupportingFile("mimetypes.mustache", "src", "mimetypes.rs")); supportingFiles.add(new SupportingFile("server-mod.mustache", "src/server", "mod.rs")); supportingFiles.add(new SupportingFile("client-mod.mustache", "src/client", "mod.rs")); supportingFiles.add(new SupportingFile("example-server-main.mustache", "examples/server", "main.rs")); diff --git a/modules/openapi-generator/src/main/resources/rust-server/README.md b/modules/openapi-generator/src/main/resources/rust-server/README.md index 892861cd7b6..3e2bf9cbf57 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/README.md +++ b/modules/openapi-generator/src/main/resources/rust-server/README.md @@ -30,9 +30,6 @@ The following tree shows which templates include which: - `header.mustache` - `lib.mustache` - `response.mustache` -- `mimetypes.mustache` - - `mimetypes-request.mustache` - - `mimetypes-response.mustache` - `model_doc.mustache` - `models.mustache` - `openapi.mustache` diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache index 618b5c26457..e42746eb0bb 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache @@ -39,7 +39,6 @@ use uuid; use serde_xml_rs; {{/usesXml}} -use mimetypes; use models; use header; diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache index 9a456e792f6..a944e09565c 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache @@ -143,7 +143,7 @@ ]; let body = serde_urlencoded::to_string(params).expect("impossible to fail to serialize"); - let header = &mimetypes::requests::{{#vendorExtensions}}{{{uppercase_operation_id}}}{{/vendorExtensions}}; + let header = "{{#consumes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/consumes}}{{^consumes}}application/json{{/consumes}}"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -203,7 +203,7 @@ // Add the message body to the request object. *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::{{#vendorExtensions}}{{{uppercase_operation_id}}}{{/vendorExtensions}}; + let header = "{{#consumes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/consumes}}{{^consumes}}application/json{{/consumes}}"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_bytes( &[header.as_bytes(), "; boundary=".as_bytes(), &boundary, "; type=\"application/json\"".as_bytes()].concat() @@ -261,7 +261,7 @@ } {{/required}} - let header = &mimetypes::requests::{{#vendorExtensions}}{{{uppercase_operation_id}}}{{/vendorExtensions}}; + let header = "{{#consumes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/consumes}}{{^consumes}}application/json{{/consumes}}"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) diff --git a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache index 61159b38083..cf2ada5d089 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache @@ -91,9 +91,6 @@ use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; -#[cfg(any(feature = "client", feature = "server"))] -mod mimetypes; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/modules/openapi-generator/src/main/resources/rust-server/mimetypes-request.mustache b/modules/openapi-generator/src/main/resources/rust-server/mimetypes-request.mustache deleted file mode 100644 index 5a71a6f93f8..00000000000 --- a/modules/openapi-generator/src/main/resources/rust-server/mimetypes-request.mustache +++ /dev/null @@ -1,22 +0,0 @@ -{{^vendorExtensions.consumesMultipart}} - {{#bodyParam}} - /// Create &str objects for the request content types for {{{operationId}}} - pub static {{{vendorExtensions.uppercase_operation_id}}}: &str = "{{#consumes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/consumes}}{{^consumes}}application/json{{/consumes}}"; - {{/bodyParam}} - {{^bodyParam}} - {{#vendorExtensions}} - {{#formParams}} - {{#-first}} - /// Create &str objects for the request content types for {{{operationId}}} - pub static {{{uppercase_operation_id}}}: &str = "{{#consumes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/consumes}}{{^consumes}}application/x-www-form-urlencoded{{/consumes}}"; - {{/-first}} - {{/formParams}} - {{#relatedParams}} - {{#-first}} - /// Create &str objects for the request content types for {{{operationId}}} - pub static {{{uppercase_operation_id}}}: &str = "{{#consumes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/consumes}}{{^consumes}}multipart/related{{/consumes}}"; - {{/-first}} - {{/relatedParams}} - {{/vendorExtensions}} - {{/bodyParam}} -{{/vendorExtensions.consumesMultipart}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/mimetypes-response.mustache b/modules/openapi-generator/src/main/resources/rust-server/mimetypes-response.mustache deleted file mode 100644 index 23b1f9f54fe..00000000000 --- a/modules/openapi-generator/src/main/resources/rust-server/mimetypes-response.mustache +++ /dev/null @@ -1,10 +0,0 @@ -{{#responses}} - {{#produces}} - {{#-first}} - {{#dataType}} - /// Create &str objects for the response content types for {{{operationId}}} - pub static {{#vendorExtensions}}{{{uppercase_operation_id}}}_{{x-uppercaseResponseId}}: &str = "{{{mimeType}}}";{{/vendorExtensions}} - {{/dataType}} - {{/-first}} - {{/produces}} -{{/responses}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache b/modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache deleted file mode 100644 index 2b16ee3adb2..00000000000 --- a/modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache +++ /dev/null @@ -1,39 +0,0 @@ -/// mime types for requests and responses - -pub mod responses { -{{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} -{{>mimetypes-response}} - {{#callbacks}} - {{#urls}} - {{#requests}} -{{>mimetypes-response}} - {{/requests}} - {{/urls}} - {{/callbacks}} - {{/operation}} - {{/operations}} - {{/apis}} -{{/apiInfo}} -} - -pub mod requests { -{{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} -{{>mimetypes-request}} - {{#callbacks}} - {{#urls}} - {{#requests}} -{{>mimetypes-request}} - {{/requests}} - {{/urls}} - {{/callbacks}} - {{/operation}} - {{/operations}} - {{/apis}} -{{/apiInfo}} -} diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache index 4386a6c1aa8..c4485bcc313 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache index 320ac4e9744..6663d6f6871 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache @@ -499,7 +499,7 @@ {{#vendorExtensions}} response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::{{{uppercase_operation_id}}}_{{x-uppercaseResponseId}}) + HeaderValue::from_str("{{{mimeType}}}") .expect("Unable to create Content-Type header for {{{uppercase_operation_id}}}_{{x-uppercaseResponseId}}")); {{/vendorExtensions}} {{/dataType}} diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs index 17fdae55910..117b34ab85b 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs @@ -29,7 +29,6 @@ use hyper_0_10::header::{Headers, ContentType}; header! { (ContentId, "Content-ID") => [String] } use mime_multipart::{Node, Part, generate_boundary, write_multipart}; -use mimetypes; use models; use header; @@ -356,7 +355,7 @@ impl Api for Client where // Add the message body to the request object. *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::MULTIPART_RELATED_REQUEST_POST; + let header = "multipart/related"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_bytes( &[header.as_bytes(), "; boundary=".as_bytes(), &boundary, "; type=\"application/json\"".as_bytes()].concat() @@ -634,7 +633,7 @@ impl Api for Client where // Add the message body to the request object. *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::MULTIPLE_IDENTICAL_MIME_TYPES_POST; + let header = "multipart/related"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_bytes( &[header.as_bytes(), "; boundary=".as_bytes(), &boundary, "; type=\"application/json\"".as_bytes()].concat() diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs index 118f55c01a0..6f943b310e7 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs @@ -68,9 +68,6 @@ use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; -#[cfg(any(feature = "client", feature = "server"))] -mod mimetypes; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/mimetypes.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/mimetypes.rs deleted file mode 100644 index 01c45da029a..00000000000 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/mimetypes.rs +++ /dev/null @@ -1,17 +0,0 @@ -/// mime types for requests and responses - -pub mod responses { - - - -} - -pub mod requests { - /// Create &str objects for the request content types for MultipartRelatedRequestPost - pub static MULTIPART_RELATED_REQUEST_POST: &str = "multipart/related"; - - - /// Create &str objects for the request content types for MultipleIdenticalMimeTypesPost - pub static MULTIPLE_IDENTICAL_MIME_TYPES_POST: &str = "multipart/related"; - -} diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs index 32e11d82d4c..8fe5570f9b7 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs index 23168fb5ed5..7823059fba3 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs @@ -23,7 +23,6 @@ use swagger::{ApiError, Connector, client::Service, XSpanIdString, Has, AuthData use url::form_urlencoded; use url::percent_encoding::{utf8_percent_encode, PATH_SEGMENT_ENCODE_SET, QUERY_ENCODE_SET}; -use mimetypes; use models; use header; @@ -289,7 +288,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::OP_GET; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs index 56bb10fea47..6db786d0c8e 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs @@ -59,9 +59,6 @@ use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; -#[cfg(any(feature = "client", feature = "server"))] -mod mimetypes; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/mimetypes.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/mimetypes.rs deleted file mode 100644 index 54de7151c4a..00000000000 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/mimetypes.rs +++ /dev/null @@ -1,11 +0,0 @@ -/// mime types for requests and responses - -pub mod responses { - -} - -pub mod requests { - /// Create &str objects for the request content types for OpGet - pub static OP_GET: &str = "application/json"; - -} diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs index ee44eb329dd..08e06a62739 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs index b02cc63610c..92223016e37 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs index a9ae3b12ec8..7284e8b3a81 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs @@ -25,7 +25,6 @@ use url::percent_encoding::{utf8_percent_encode, PATH_SEGMENT_ENCODE_SET, QUERY_ use uuid; use serde_xml_rs; -use mimetypes; use models; use header; @@ -1158,7 +1157,7 @@ impl Api for Client where let body = param_body.0; *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::REQUIRED_OCTET_STREAM_PUT; + let header = "application/octet-stream"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1482,7 +1481,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::UNTYPED_PROPERTY_GET; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1649,7 +1648,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::XML_EXTRA_POST; + let header = "application/xml"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1741,7 +1740,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::XML_OTHER_POST; + let header = "application/xml"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1833,7 +1832,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::XML_OTHER_PUT; + let header = "application/xml"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1925,7 +1924,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::XML_POST; + let header = "application/xml"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -2018,7 +2017,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::XML_PUT; + let header = "application/xml"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs index 0fcba48f013..8573ddb8d9c 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs @@ -59,9 +59,6 @@ use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; -#[cfg(any(feature = "client", feature = "server"))] -mod mimetypes; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs deleted file mode 100644 index 082339031e8..00000000000 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs +++ /dev/null @@ -1,91 +0,0 @@ -/// mime types for requests and responses - -pub mod responses { - - - - - /// Create &str objects for the response content types for MergePatchJsonGet - pub static MERGE_PATCH_JSON_GET_MERGE: &str = "application/merge-patch+json"; - - /// Create &str objects for the response content types for MultigetGet - pub static MULTIGET_GET_JSON_RSP: &str = "application/json"; - /// Create &str objects for the response content types for MultigetGet - pub static MULTIGET_GET_XML_RSP: &str = "application/xml"; - /// Create &str objects for the response content types for MultigetGet - pub static MULTIGET_GET_OCTET_RSP: &str = "application/octet-stream"; - /// Create &str objects for the response content types for MultigetGet - pub static MULTIGET_GET_STRING_RSP: &str = "text/plain"; - /// Create &str objects for the response content types for MultigetGet - pub static MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT: &str = "application/json"; - /// Create &str objects for the response content types for MultigetGet - pub static MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_2: &str = "application/json"; - /// Create &str objects for the response content types for MultigetGet - pub static MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_3: &str = "application/json"; - - - /// Create &str objects for the response content types for ParamgetGet - pub static PARAMGET_GET_JSON_RSP: &str = "application/json"; - - - - - - /// Create &str objects for the response content types for ResponsesWithHeadersGet - pub static RESPONSES_WITH_HEADERS_GET_SUCCESS: &str = "application/json"; - - /// Create &str objects for the response content types for Rfc7807Get - pub static RFC7807_GET_OK: &str = "application/json"; - /// Create &str objects for the response content types for Rfc7807Get - pub static RFC7807_GET_NOT_FOUND: &str = "application/problem+json"; - /// Create &str objects for the response content types for Rfc7807Get - pub static RFC7807_GET_NOT_ACCEPTABLE: &str = "application/problem+xml"; - - - /// Create &str objects for the response content types for UuidGet - pub static UUID_GET_DUPLICATE_RESPONSE_LONG_TEXT: &str = "application/json"; - - - - - - -} - -pub mod requests { - - - - - - - - - - - - /// Create &str objects for the request content types for RequiredOctetStreamPut - pub static REQUIRED_OCTET_STREAM_PUT: &str = "application/octet-stream"; - - - - /// Create &str objects for the request content types for UntypedPropertyGet - pub static UNTYPED_PROPERTY_GET: &str = "application/json"; - - - /// Create &str objects for the request content types for XmlExtraPost - pub static XML_EXTRA_POST: &str = "application/xml"; - - /// Create &str objects for the request content types for XmlOtherPost - pub static XML_OTHER_POST: &str = "application/xml"; - - /// Create &str objects for the request content types for XmlOtherPut - pub static XML_OTHER_PUT: &str = "application/xml"; - - /// Create &str objects for the request content types for XmlPost - pub static XML_POST: &str = "application/xml"; - - /// Create &str objects for the request content types for XmlPut - pub static XML_PUT: &str = "application/xml"; - -} diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs index 36f52eab18a..c07af6a9eff 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs @@ -25,7 +25,6 @@ use url::percent_encoding::{utf8_percent_encode, PATH_SEGMENT_ENCODE_SET, QUERY_ use uuid; use serde_xml_rs; -use mimetypes; use models; use header; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs index 939223c1fca..419d9bfc4e7 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] @@ -366,7 +365,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MERGE_PATCH_JSON_GET_MERGE) + HeaderValue::from_str("application/merge-patch+json") .expect("Unable to create Content-Type header for MERGE_PATCH_JSON_GET_MERGE")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -409,7 +408,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MULTIGET_GET_JSON_RSP) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for MULTIGET_GET_JSON_RSP")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -420,7 +419,7 @@ where *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MULTIGET_GET_XML_RSP) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for MULTIGET_GET_XML_RSP")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -431,7 +430,7 @@ where *response.status_mut() = StatusCode::from_u16(202).expect("Unable to turn 202 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MULTIGET_GET_OCTET_RSP) + HeaderValue::from_str("application/octet-stream") .expect("Unable to create Content-Type header for MULTIGET_GET_OCTET_RSP")); let body = body.0; *response.body_mut() = Body::from(body); @@ -442,7 +441,7 @@ where *response.status_mut() = StatusCode::from_u16(203).expect("Unable to turn 203 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MULTIGET_GET_STRING_RSP) + HeaderValue::from_str("text/plain") .expect("Unable to create Content-Type header for MULTIGET_GET_STRING_RSP")); let body = body; *response.body_mut() = Body::from(body); @@ -453,7 +452,7 @@ where *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -464,7 +463,7 @@ where *response.status_mut() = StatusCode::from_u16(205).expect("Unable to turn 205 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_2) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_2")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -475,7 +474,7 @@ where *response.status_mut() = StatusCode::from_u16(206).expect("Unable to turn 206 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_3) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_3")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -599,7 +598,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::PARAMGET_GET_JSON_RSP) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for PARAMGET_GET_JSON_RSP")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -835,7 +834,7 @@ where ); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::RESPONSES_WITH_HEADERS_GET_SUCCESS) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for RESPONSES_WITH_HEADERS_GET_SUCCESS")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -894,7 +893,7 @@ where *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::RFC7807_GET_OK) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for RFC7807_GET_OK")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -905,7 +904,7 @@ where *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::RFC7807_GET_NOT_FOUND) + HeaderValue::from_str("application/problem+json") .expect("Unable to create Content-Type header for RFC7807_GET_NOT_FOUND")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -916,7 +915,7 @@ where *response.status_mut() = StatusCode::from_u16(406).expect("Unable to turn 406 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::RFC7807_GET_NOT_ACCEPTABLE) + HeaderValue::from_str("application/problem+xml") .expect("Unable to create Content-Type header for RFC7807_GET_NOT_ACCEPTABLE")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -1028,7 +1027,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::UUID_GET_DUPLICATE_RESPONSE_LONG_TEXT) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for UUID_GET_DUPLICATE_RESPONSE_LONG_TEXT")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs index 55f0100eeab..56497beb555 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs @@ -23,7 +23,6 @@ use swagger::{ApiError, Connector, client::Service, XSpanIdString, Has, AuthData use url::form_urlencoded; use url::percent_encoding::{utf8_percent_encode, PATH_SEGMENT_ENCODE_SET, QUERY_ENCODE_SET}; -use mimetypes; use models; use header; diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs index 4d6fa2c4a3d..094557b8b57 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs @@ -59,9 +59,6 @@ use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; -#[cfg(any(feature = "client", feature = "server"))] -mod mimetypes; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/mimetypes.rs b/samples/server/petstore/rust-server/output/ops-v3/src/mimetypes.rs deleted file mode 100644 index 4909871f1b4..00000000000 --- a/samples/server/petstore/rust-server/output/ops-v3/src/mimetypes.rs +++ /dev/null @@ -1,81 +0,0 @@ -/// mime types for requests and responses - -pub mod responses { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} - -pub mod requests { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs index 9f2e19d645f..ebf9b84de3c 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs index 5232a771d6e..082850f9dd5 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs @@ -28,7 +28,6 @@ use multipart::client::lazy::Multipart; use uuid; use serde_xml_rs; -use mimetypes; use models; use header; @@ -328,7 +327,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::TEST_SPECIAL_TAGS; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -496,7 +495,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::FAKE_OUTER_BOOLEAN_SERIALIZE; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -592,7 +591,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::FAKE_OUTER_COMPOSITE_SERIALIZE; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -688,7 +687,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::FAKE_OUTER_NUMBER_SERIALIZE; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -784,7 +783,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); } - let header = &mimetypes::requests::FAKE_OUTER_STRING_SERIALIZE; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1022,7 +1021,7 @@ impl Api for Client where let body = serde_json::to_string(¶m_body).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::TEST_BODY_WITH_QUERY_PARAMS; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1102,7 +1101,7 @@ impl Api for Client where let body = serde_json::to_string(¶m_body).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::TEST_CLIENT_MODEL; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1222,7 +1221,7 @@ impl Api for Client where ]; let body = serde_urlencoded::to_string(params).expect("impossible to fail to serialize"); - let header = &mimetypes::requests::TEST_ENDPOINT_PARAMETERS; + let header = "application/x-www-form-urlencoded"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1348,7 +1347,7 @@ impl Api for Client where ]; let body = serde_urlencoded::to_string(params).expect("impossible to fail to serialize"); - let header = &mimetypes::requests::TEST_ENUM_PARAMETERS; + let header = "application/x-www-form-urlencoded"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1446,7 +1445,7 @@ impl Api for Client where let body = serde_json::to_string(¶m_param).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::TEST_INLINE_ADDITIONAL_PROPERTIES; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1530,7 +1529,7 @@ impl Api for Client where ]; let body = serde_urlencoded::to_string(params).expect("impossible to fail to serialize"); - let header = &mimetypes::requests::TEST_JSON_FORM_DATA; + let header = "application/x-www-form-urlencoded"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1618,7 +1617,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::TEST_CLASSNAME; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -1719,7 +1718,7 @@ impl Api for Client where let body = param_body.to_xml(); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::ADD_PET; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -2246,7 +2245,7 @@ impl Api for Client where let body = param_body.to_xml(); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::UPDATE_PET; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -2365,7 +2364,7 @@ impl Api for Client where ]; let body = serde_urlencoded::to_string(params).expect("impossible to fail to serialize"); - let header = &mimetypes::requests::UPDATE_PET_WITH_FORM; + let header = "application/x-www-form-urlencoded"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -2891,7 +2890,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::PLACE_ORDER; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -2995,7 +2994,7 @@ impl Api for Client where let body = serde_json::to_string(¶m_body).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::CREATE_USER; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -3075,7 +3074,7 @@ impl Api for Client where let body = serde_json::to_string(¶m_body).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::CREATE_USERS_WITH_ARRAY_INPUT; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -3155,7 +3154,7 @@ impl Api for Client where let body = serde_json::to_string(¶m_body).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::CREATE_USERS_WITH_LIST_INPUT; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -3602,7 +3601,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::UPDATE_USER; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index 004b9babcf6..a48601d8b2e 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -63,9 +63,6 @@ use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; -#[cfg(any(feature = "client", feature = "server"))] -mod mimetypes; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs deleted file mode 100644 index 4c9a9f0eefa..00000000000 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs +++ /dev/null @@ -1,149 +0,0 @@ -/// mime types for requests and responses - -pub mod responses { - /// Create &str objects for the response content types for TestSpecialTags - pub static TEST_SPECIAL_TAGS_SUCCESSFUL_OPERATION: &str = "application/json"; - - - /// Create &str objects for the response content types for FakeOuterBooleanSerialize - pub static FAKE_OUTER_BOOLEAN_SERIALIZE_OUTPUT_BOOLEAN: &str = "*/*"; - - /// Create &str objects for the response content types for FakeOuterCompositeSerialize - pub static FAKE_OUTER_COMPOSITE_SERIALIZE_OUTPUT_COMPOSITE: &str = "*/*"; - - /// Create &str objects for the response content types for FakeOuterNumberSerialize - pub static FAKE_OUTER_NUMBER_SERIALIZE_OUTPUT_NUMBER: &str = "*/*"; - - /// Create &str objects for the response content types for FakeOuterStringSerialize - pub static FAKE_OUTER_STRING_SERIALIZE_OUTPUT_STRING: &str = "*/*"; - - - - - /// Create &str objects for the response content types for TestClientModel - pub static TEST_CLIENT_MODEL_SUCCESSFUL_OPERATION: &str = "application/json"; - - - - - - /// Create &str objects for the response content types for TestClassname - pub static TEST_CLASSNAME_SUCCESSFUL_OPERATION: &str = "application/json"; - - - - /// Create &str objects for the response content types for FindPetsByStatus - pub static FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION: &str = "application/xml"; - - /// Create &str objects for the response content types for FindPetsByTags - pub static FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION: &str = "application/xml"; - - /// Create &str objects for the response content types for GetPetById - pub static GET_PET_BY_ID_SUCCESSFUL_OPERATION: &str = "application/xml"; - - - - /// Create &str objects for the response content types for UploadFile - pub static UPLOAD_FILE_SUCCESSFUL_OPERATION: &str = "application/json"; - - - /// Create &str objects for the response content types for GetInventory - pub static GET_INVENTORY_SUCCESSFUL_OPERATION: &str = "application/json"; - - /// Create &str objects for the response content types for GetOrderById - pub static GET_ORDER_BY_ID_SUCCESSFUL_OPERATION: &str = "application/xml"; - - /// Create &str objects for the response content types for PlaceOrder - pub static PLACE_ORDER_SUCCESSFUL_OPERATION: &str = "application/xml"; - - - - - - /// Create &str objects for the response content types for GetUserByName - pub static GET_USER_BY_NAME_SUCCESSFUL_OPERATION: &str = "application/xml"; - - /// Create &str objects for the response content types for LoginUser - pub static LOGIN_USER_SUCCESSFUL_OPERATION: &str = "application/xml"; - - - -} - -pub mod requests { - /// Create &str objects for the request content types for TestSpecialTags - pub static TEST_SPECIAL_TAGS: &str = "application/json"; - - - /// Create &str objects for the request content types for FakeOuterBooleanSerialize - pub static FAKE_OUTER_BOOLEAN_SERIALIZE: &str = "application/json"; - - /// Create &str objects for the request content types for FakeOuterCompositeSerialize - pub static FAKE_OUTER_COMPOSITE_SERIALIZE: &str = "application/json"; - - /// Create &str objects for the request content types for FakeOuterNumberSerialize - pub static FAKE_OUTER_NUMBER_SERIALIZE: &str = "application/json"; - - /// Create &str objects for the request content types for FakeOuterStringSerialize - pub static FAKE_OUTER_STRING_SERIALIZE: &str = "application/json"; - - - - /// Create &str objects for the request content types for TestBodyWithQueryParams - pub static TEST_BODY_WITH_QUERY_PARAMS: &str = "application/json"; - - /// Create &str objects for the request content types for TestClientModel - pub static TEST_CLIENT_MODEL: &str = "application/json"; - - /// Create &str objects for the request content types for TestEndpointParameters - pub static TEST_ENDPOINT_PARAMETERS: &str = "application/x-www-form-urlencoded"; - - /// Create &str objects for the request content types for TestEnumParameters - pub static TEST_ENUM_PARAMETERS: &str = "application/x-www-form-urlencoded"; - - /// Create &str objects for the request content types for TestInlineAdditionalProperties - pub static TEST_INLINE_ADDITIONAL_PROPERTIES: &str = "application/json"; - - /// Create &str objects for the request content types for TestJsonFormData - pub static TEST_JSON_FORM_DATA: &str = "application/x-www-form-urlencoded"; - - /// Create &str objects for the request content types for TestClassname - pub static TEST_CLASSNAME: &str = "application/json"; - - /// Create &str objects for the request content types for AddPet - pub static ADD_PET: &str = "application/json"; - - - - - - /// Create &str objects for the request content types for UpdatePet - pub static UPDATE_PET: &str = "application/json"; - - /// Create &str objects for the request content types for UpdatePetWithForm - pub static UPDATE_PET_WITH_FORM: &str = "application/x-www-form-urlencoded"; - - - - - - /// Create &str objects for the request content types for PlaceOrder - pub static PLACE_ORDER: &str = "application/json"; - - /// Create &str objects for the request content types for CreateUser - pub static CREATE_USER: &str = "application/json"; - - /// Create &str objects for the request content types for CreateUsersWithArrayInput - pub static CREATE_USERS_WITH_ARRAY_INPUT: &str = "application/json"; - - /// Create &str objects for the request content types for CreateUsersWithListInput - pub static CREATE_USERS_WITH_LIST_INPUT: &str = "application/json"; - - - - - - /// Create &str objects for the request content types for UpdateUser - pub static UPDATE_USER: &str = "application/json"; - -} diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index a3cd9858235..567b5feecb7 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] @@ -296,7 +295,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::TEST_SPECIAL_TAGS_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for TEST_SPECIAL_TAGS_SUCCESSFUL_OPERATION")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -408,7 +407,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::FAKE_OUTER_BOOLEAN_SERIALIZE_OUTPUT_BOOLEAN) + HeaderValue::from_str("*/*") .expect("Unable to create Content-Type header for FAKE_OUTER_BOOLEAN_SERIALIZE_OUTPUT_BOOLEAN")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -484,7 +483,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::FAKE_OUTER_COMPOSITE_SERIALIZE_OUTPUT_COMPOSITE) + HeaderValue::from_str("*/*") .expect("Unable to create Content-Type header for FAKE_OUTER_COMPOSITE_SERIALIZE_OUTPUT_COMPOSITE")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -560,7 +559,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::FAKE_OUTER_NUMBER_SERIALIZE_OUTPUT_NUMBER) + HeaderValue::from_str("*/*") .expect("Unable to create Content-Type header for FAKE_OUTER_NUMBER_SERIALIZE_OUTPUT_NUMBER")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -636,7 +635,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::FAKE_OUTER_STRING_SERIALIZE_OUTPUT_STRING) + HeaderValue::from_str("*/*") .expect("Unable to create Content-Type header for FAKE_OUTER_STRING_SERIALIZE_OUTPUT_STRING")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -916,7 +915,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::TEST_CLIENT_MODEL_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for TEST_CLIENT_MODEL_SUCCESSFUL_OPERATION")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -1295,7 +1294,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::TEST_CLASSNAME_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for TEST_CLASSNAME_SUCCESSFUL_OPERATION")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -1588,7 +1587,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -1672,7 +1671,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -1753,7 +1752,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::GET_PET_BY_ID_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for GET_PET_BY_ID_SUCCESSFUL_OPERATION")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -2148,7 +2147,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::UPLOAD_FILE_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for UPLOAD_FILE_SUCCESSFUL_OPERATION")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -2272,7 +2271,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::GET_INVENTORY_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for GET_INVENTORY_SUCCESSFUL_OPERATION")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -2339,7 +2338,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::GET_ORDER_BY_ID_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for GET_ORDER_BY_ID_SUCCESSFUL_OPERATION")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -2427,7 +2426,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::PLACE_ORDER_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for PLACE_ORDER_SUCCESSFUL_OPERATION")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -2805,7 +2804,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::GET_USER_BY_NAME_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for GET_USER_BY_NAME_SUCCESSFUL_OPERATION")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -2903,7 +2902,7 @@ where ); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::LOGIN_USER_SUCCESSFUL_OPERATION) + HeaderValue::from_str("application/xml") .expect("Unable to create Content-Type header for LOGIN_USER_SUCCESSFUL_OPERATION")); let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs index d81fbd9ae76..77baf0552ff 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs @@ -23,7 +23,6 @@ use swagger::{ApiError, Connector, client::Service, XSpanIdString, Has, AuthData use url::form_urlencoded; use url::percent_encoding::{utf8_percent_encode, PATH_SEGMENT_ENCODE_SET, QUERY_ENCODE_SET}; -use mimetypes; use models; use header; @@ -449,7 +448,7 @@ impl Api for Client where let body = serde_json::to_string(¶m_nested_response).expect("impossible to fail to serialize"); *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::DUMMY_PUT; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -694,7 +693,7 @@ impl Api for Client where let body = param_body; *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::HTML_POST; + let header = "text/html"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -785,7 +784,7 @@ impl Api for Client where let body = param_value; *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::POST_YAML; + let header = "application/yaml"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) @@ -949,7 +948,7 @@ impl Api for Client where *request.body_mut() = Body::from(body); - let header = &mimetypes::requests::SOLO_OBJECT_POST; + let header = "application/json"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) { Ok(h) => h, Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e)))) diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs index 0c6e36818c7..e99ca3e563d 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs @@ -59,9 +59,6 @@ use std::io::Error; #[allow(unused_imports)] use std::collections::HashMap; -#[cfg(any(feature = "client", feature = "server"))] -mod mimetypes; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/mimetypes.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/mimetypes.rs deleted file mode 100644 index acdd6186f6e..00000000000 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/mimetypes.rs +++ /dev/null @@ -1,43 +0,0 @@ -/// mime types for requests and responses - -pub mod responses { - /// Create &str objects for the response content types for AllOfGet - pub static ALL_OF_GET_OK: &str = "*/*"; - - - - /// Create &str objects for the response content types for FileResponseGet - pub static FILE_RESPONSE_GET_SUCCESS: &str = "application/json"; - - /// Create &str objects for the response content types for GetStructuredYaml - pub static GET_STRUCTURED_YAML_OK: &str = "application/yaml"; - - /// Create &str objects for the response content types for HtmlPost - pub static HTML_POST_SUCCESS: &str = "text/html"; - - - /// Create &str objects for the response content types for RawJsonGet - pub static RAW_JSON_GET_SUCCESS: &str = "*/*"; - - -} - -pub mod requests { - - - /// Create &str objects for the request content types for DummyPut - pub static DUMMY_PUT: &str = "application/json"; - - - - /// Create &str objects for the request content types for HtmlPost - pub static HTML_POST: &str = "text/html"; - - /// Create &str objects for the request content types for PostYaml - pub static POST_YAML: &str = "application/yaml"; - - - /// Create &str objects for the request content types for SoloObjectPost - pub static SOLO_OBJECT_POST: &str = "application/json"; - -} diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs index 96a10eee30d..56c2050b8f1 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs @@ -6,7 +6,6 @@ use hyper; use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use url::form_urlencoded; -use mimetypes; use serde_json; use std::io; #[allow(unused_imports)] @@ -166,7 +165,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::ALL_OF_GET_OK) + HeaderValue::from_str("*/*") .expect("Unable to create Content-Type header for ALL_OF_GET_OK")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -324,7 +323,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::FILE_RESPONSE_GET_SUCCESS) + HeaderValue::from_str("application/json") .expect("Unable to create Content-Type header for FILE_RESPONSE_GET_SUCCESS")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); @@ -367,7 +366,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::GET_STRUCTURED_YAML_OK) + HeaderValue::from_str("application/yaml") .expect("Unable to create Content-Type header for GET_STRUCTURED_YAML_OK")); let body = body; *response.body_mut() = Body::from(body); @@ -435,7 +434,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::HTML_POST_SUCCESS) + HeaderValue::from_str("text/html") .expect("Unable to create Content-Type header for HTML_POST_SUCCESS")); let body = body; *response.body_mut() = Body::from(body); @@ -551,7 +550,7 @@ where *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str(mimetypes::responses::RAW_JSON_GET_SUCCESS) + HeaderValue::from_str("*/*") .expect("Unable to create Content-Type header for RAW_JSON_GET_SUCCESS")); let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body);