Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
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");
Expand Down Expand Up @@ -1926,7 +1930,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/ruby/docs/FakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ No authorization required

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json
- **Content-Type**: */*
- **Accept**: */*



4 changes: 2 additions & 2 deletions samples/client/petstore/ruby/lib/petstore/api/fake_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ def test_enum_parameters_with_http_info(opts = {})
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?
Expand Down
3 changes: 2 additions & 1 deletion samples/client/petstore/ruby/lib/petstore/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ def build_request(http_method, path, opts = {})
# 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.
Expand Down