static ResponseHeaders buildResponseHeaders(ServiceRequestContext ctx, ResponseEntity<?> result) {
        final ResponseHeaders headers = result.headers();

        if (headers.status().isContentAlwaysEmpty()) {
            return headers;
        }
        if (headers.contentType() != null) {
            return headers;
        }

        final ResponseHeadersBuilder builder = headers.toBuilder();

        final MediaType negotiatedResponseMediaType = ctx.negotiatedResponseMediaType();
        if (negotiatedResponseMediaType != null) {
            builder.contentType(negotiatedResponseMediaType);
        }

        return builder.build();
    }
Build {@link ResponseHeaders} from the given {@link ServiceRequestContext} and {@link ResponseEntity}.
core/src/main/java/com/linecorp/armeria/internal/server/annotation/ResponseEntityUtil.java