[Java] okhttp-gson content-type fix for */* (#6232)

This commit is contained in:
Lars Wander 2017-08-04 12:47:52 -04:00 committed by wing328
parent e4276853d7
commit 86f2ea5e3e

View File

@ -608,10 +608,10 @@ public class ApiClient {
*
* @param contentTypes The Content-Type array to select from
* @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) {
if (contentTypes.length == 0) {
if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) {
return "application/json";
}
for (String contentType : contentTypes) {