private String determineContentType(
            Collection<HttpBinding> bindings,
            String documentContentType,
            String eventStreamContentType
    ) {
        Model model = getModel();

        for (HttpBinding binding : bindings) {
            if (binding.getLocation() == HttpBinding.Location.DOCUMENT) {
                return documentContentType;
            }

            if (binding.getLocation() == HttpBinding.Location.PAYLOAD) {
                Shape target = model.getShape(binding.getMember().getTarget()).orElse(null);
                if (target == null) {
                    // Can't determine the content-type because the model is broken :(
                    // Let other parts of the validation system point this out.
                    break;
                } else if (StreamingTrait.isEventStream(target)) {
                    return eventStreamContentType;
                } else if (target.isDocumentShape() || target.isStructureShape()
                        || target.isUnionShape()
                        || target.isListShape()
                        || target.isMapShape()) {
                    // Document type and structure targets are always the document content-type.
                    return documentContentType;
                } else if (target.hasTrait(MediaTypeTrait.ID)) {
                    // Use the @mediaType trait if available.
                    return target.getTrait(MediaTypeTrait.class).get().getValue();
                } else if (target.isBlobShape()) {
                    return "application/octet-stream";
                } else if (target.isStringShape()) {
                    return "text/plain";
                }
            }
        }

        return null;
    }
Returns the expected response Content-Type of the given operation
or error.

<p>If members are sent in the "document" body, then the default
{@code documentContentType} value is returned. If a member is bound
to the payload, then the following checks are made:

<ul>
    <li>If the payload has the {@link StreamingTrait}, then the
    {@code eventStreamContentType} is returned.</li>
    <li>If the targeted shape is a structure or document type, then
    the {@code documentContentType} is returned.</li>
    <li>If the targeted shape has the {@link MediaTypeTrait}, then
    the value of the trait is returned.</li>
    <li>If the targeted shape is a blob, then "application/octet-stream"
    is returned.</li>
    <li>If the targeted shape is a string, then "text/plain" is
    returned.</li>
</ul>

<p>If no members are sent in the payload, an empty Optional is
returned.

@param operationOrError Operation or error to determine the content-type of.
@param documentContentType Content-Type to use for protocol documents.
@param eventStreamContentType Content-Type used for event streams.
@return Returns the optionally resolved content-type of the response.
smithy-model/src/main/java/software/amazon/smithy/model/knowledge/HttpBindingIndex.java