@Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (msg instanceof HttpResponse) {
            HttpResponse response = (HttpResponse) msg;
            response.headers().add(REQUEST_ID_HEADER_NAME, ctx.channel().attr(StateKey.REQUEST_ID).get());
        }
        if (msg instanceof LastHttpContent) { // possible for an object to be both HttpResponse and LastHttpContent.
            ctx.channel().attr(IN_USE).set(false);
        }

        ctx.write(msg, promise);
    }
The key for whether a {@link io.netty.handler.codec.http.HttpResponse} has been sent for the current response.
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java