private Response doHttpRequest(
        final int port,
        final String path,
        final String method,
        final RequestBody body,
        final boolean auth
    ) {
        try {
            Request.Builder requestBuilder = new Request.Builder()
                .url("http://" + getHost() + ":" + getMappedPort(port) + path);

            if (auth) {
                requestBuilder = requestBuilder.header("Authorization", Credentials.basic(username, password));
            }

            if (body == null) {
                requestBuilder = requestBuilder.get();
            } else {
                requestBuilder = requestBuilder.method(method, body);
            }

            return HTTP_CLIENT.newCall(requestBuilder.build()).execute();
        } catch (Exception ex) {
            throw new RuntimeException("Could not perform request against couchbase HTTP endpoint ", ex);
        }
    }
Helper method to perform a request against a couchbase server HTTP endpoint.

@param port the (unmapped) original port that should be used.
@param path the relative http path.
@param method the http method to use.
@param body if present, will be part of the payload.
@param auth if authentication with the admin user and password should be used.
@return the response of the request.
modules/couchbase/src/main/java/org/testcontainers/couchbase/CouchbaseContainer.java