@Override
    @SuppressWarnings("unchecked")
    public final Mono<Void> writeWith(Publisher<? extends DataBuffer> body) {
        // For Mono we can avoid ChannelSendOperator and Reactor Netty is more optimized for Mono.
        // We must resolve value first however, for a chance to handle potential error.
        if (body instanceof Mono) {
            return ((Mono<? extends DataBuffer>) body).flatMap(buffer -> {
                touchDataBuffer(buffer);
                final AtomicBoolean subscribed = new AtomicBoolean();
                return doCommit(() -> {
                    try {
                        // Upstream code uses `Mono.fromCallable(() -> buffer)` which does nothing when
                        // `Subscription.cancel()` is called. It can lead to leaking of the buffer when an
                        // HttpResponse is canceled.
                        //
                        return writeWithInternal(Mono.just(buffer)
                                                     .doOnSubscribe(s -> subscribed.set(true))
                                                     .doOnDiscard(DataBuffer.class, DataBufferUtils::release));
                    } catch (Throwable ex) {
                        return Mono.error(ex);
                    }
                }).doOnError(ex -> DataBufferUtils.release(buffer))
                  .doOnCancel(() -> {
                      if (!subscribed.get()) {
                          DataBufferUtils.release(buffer);
                      }
                  });
            }).doOnError(t -> getHeaders().clearContentHeaders()).doOnDiscard(DataBuffer.class,
                                                                              DataBufferUtils::release);
        } else {
            return new ChannelSendOperator<>(body, inner -> doCommit(() -> writeWithInternal(inner)))
                    .doOnError(t -> getHeaders().clearContentHeaders());
        }
    }
Return the underlying server response.

<p><strong>Note:</strong> This is exposed mainly for internal framework
use such as WebSocket upgrades in the spring-webflux module.
spring/boot3-webflux-autoconfigure/src/main/java/com/linecorp/armeria/spring/web/reactive/AbstractServerHttpResponse.java