All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vrap.rmf.base.client.http.AcceptGZipMiddleware Maven / Gradle / Ivy

There is a newer version: 17.17.0
Show newest version

package io.vrap.rmf.base.client.http;

import java.util.concurrent.CompletableFuture;
import java.util.function.Function;

import io.vrap.rmf.base.client.ApiHttpHeaders;
import io.vrap.rmf.base.client.ApiHttpRequest;
import io.vrap.rmf.base.client.ApiHttpResponse;

/**
 * Middleware to add the header {@code Accept: gzip} to the request
 */
public class AcceptGZipMiddleware implements Middleware {
    @Override
    public CompletableFuture> invoke(final ApiHttpRequest request,
            final Function>> next) {
        return next.apply(request.withHeader(ApiHttpHeaders.ACCEPT_ENCODING, "gzip"));
    }

    public static AcceptGZipMiddleware of() {
        return new AcceptGZipMiddleware();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy