better handling of */*

This commit is contained in:
wing328
2016-11-08 16:17:51 +08:00
parent c54797bcef
commit 935bdfe628
6 changed files with 20 additions and 10 deletions

View File

@@ -1892,7 +1892,11 @@ public class DefaultCodegen {
for (String key : consumes) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < consumes.size()) {
mediaType.put("hasMore", "true");
@@ -1926,7 +1930,11 @@ public class DefaultCodegen {
for (String key : produces) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < produces.size()) {
mediaType.put("hasMore", "true");