update java petstore (okhttp-gson) samples

This commit is contained in:
wing328 2017-08-05 00:54:01 +08:00
parent 86f2ea5e3e
commit 646c2bc23c
2 changed files with 6 additions and 6 deletions

View File

@ -590,11 +590,11 @@ public class ApiClient {
* *
* @param contentTypes The Content-Type array to select from * @param contentTypes The Content-Type array to select from
* @return The Content-Type header to use. If the given array is empty, * @return The Content-Type header to use. If the given array is empty,
* JSON will be used. * or matches "any", JSON will be used.
*/ */
public String selectHeaderContentType(String[] contentTypes) { public String selectHeaderContentType(String[] contentTypes) {
if (contentTypes.length == 0) { if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) {
return "application/json"; return "application/json";
} }
for (String contentType : contentTypes) { for (String contentType : contentTypes) {
if (isJsonMime(contentType)) { if (isJsonMime(contentType)) {

View File

@ -590,11 +590,11 @@ public class ApiClient {
* *
* @param contentTypes The Content-Type array to select from * @param contentTypes The Content-Type array to select from
* @return The Content-Type header to use. If the given array is empty, * @return The Content-Type header to use. If the given array is empty,
* JSON will be used. * or matches "any", JSON will be used.
*/ */
public String selectHeaderContentType(String[] contentTypes) { public String selectHeaderContentType(String[] contentTypes) {
if (contentTypes.length == 0) { if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) {
return "application/json"; return "application/json";
} }
for (String contentType : contentTypes) { for (String contentType : contentTypes) {
if (isJsonMime(contentType)) { if (isJsonMime(contentType)) {