@Override
    public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context)
            throws HttpException, IOException {
        Args.notNull(request, "HTTP request");

        if (!request.containsHeader(HttpHeaders.EXPECT)) {
            final HttpClientContext clientContext = HttpClientContext.cast(context);
            final ProtocolVersion version = request.getVersion() != null ? request.getVersion() : clientContext.getProtocolVersion();
            // Do not send the expect header if request body is known to be empty
            if (entity != null
                    && entity.getContentLength() != 0 && !version.lessEquals(HttpVersion.HTTP_1_0)) {
                final RequestConfig config = clientContext.getRequestConfigOrDefault();
                if (config.isExpectContinueEnabled()) {
                    request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
                }
            }
        }
    }
RequestExpectContinue is responsible for enabling the 'expect-continue'
handshake by adding {@code Expect} header.
<p>
This interceptor takes into account {@link RequestConfig#isExpectContinueEnabled()}
setting.
</p>

@since 4.3
httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestExpectContinue.java