forked from loafle/openapi-generator-original
better handling of */*
This commit is contained in:
parent
c54797bcef
commit
935bdfe628
@ -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
|
||||
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
|
||||
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");
|
||||
|
@ -125,10 +125,11 @@ module {{moduleName}}
|
||||
# application/json
|
||||
# application/json; charset=UTF8
|
||||
# APPLICATION/JSON
|
||||
# */*
|
||||
# @param [String] mime MIME
|
||||
# @return [Boolean] True if the MIME is application/json
|
||||
def json_mime?(mime)
|
||||
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
(mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
end
|
||||
|
||||
# Deserialize the response to the given return type.
|
||||
|
@ -590,9 +590,9 @@ paths:
|
||||
descriptions: To test enum parameters
|
||||
operationId: testEnumParameters
|
||||
consumes:
|
||||
- application/json
|
||||
- "*/*"
|
||||
produces:
|
||||
- application/json
|
||||
- "*/*"
|
||||
parameters:
|
||||
- name: enum_form_string_array
|
||||
type: array
|
||||
|
@ -191,8 +191,8 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
- **Content-Type**: */*
|
||||
- **Accept**: */*
|
||||
|
||||
|
||||
|
||||
|
@ -306,11 +306,11 @@ module Petstore
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
local_header_accept = ['application/json']
|
||||
local_header_accept = ['*/*']
|
||||
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
local_header_content_type = ['application/json']
|
||||
local_header_content_type = ['*/*']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
||||
header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil?
|
||||
header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil?
|
||||
|
@ -142,10 +142,11 @@ module Petstore
|
||||
# application/json
|
||||
# application/json; charset=UTF8
|
||||
# APPLICATION/JSON
|
||||
# */*
|
||||
# @param [String] mime MIME
|
||||
# @return [Boolean] True if the MIME is application/json
|
||||
def json_mime?(mime)
|
||||
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
(mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
end
|
||||
|
||||
# Deserialize the response to the given return type.
|
||||
|
Loading…
x
Reference in New Issue
Block a user