@@ -1096,7 +1096,7 @@ private void writeContentTypeHeader(GenerationContext context, Shape operationOr
1096
1096
optionalContentType = bindingIndex .determineResponseContentType (operationOrError , getDocumentContentType ());
1097
1097
}
1098
1098
// If we need to write a default body then it needs a content type.
1099
- if (! optionalContentType .isPresent () && shouldWriteDefaultBody (context , operationOrError , isInput )) {
1099
+ if (optionalContentType .isEmpty () && shouldWriteDefaultBody (context , operationOrError , isInput )) {
1100
1100
optionalContentType = Optional .of (getDocumentContentType ());
1101
1101
}
1102
1102
optionalContentType .ifPresent (contentType -> {
@@ -1143,16 +1143,16 @@ private boolean shouldWriteDefaultBody(GenerationContext context, Shape operatio
1143
1143
}
1144
1144
1145
1145
/**
1146
- * Given a context and operation, should a default input body be written. By default no body will be written
1147
- * if there are no members bound to the input.
1146
+ * Given a context and operation, should a default input body be written. By default, a body
1147
+ * will be written if and only if there are payload members bound to the input.
1148
1148
*
1149
1149
* @param context The generation context.
1150
1150
* @param operation The operation whose input is being serialized.
1151
1151
*
1152
1152
* @return True if a default body should be generated.
1153
1153
*/
1154
1154
protected boolean shouldWriteDefaultInputBody (GenerationContext context , OperationShape operation ) {
1155
- return HttpBindingIndex .of (context .getModel ()).getRequestBindings (operation ). isEmpty ( );
1155
+ return HttpBindingIndex .of (context .getModel ()).hasRequestBody (operation );
1156
1156
}
1157
1157
1158
1158
/**
0 commit comments