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

io.mosip.pmp.partner.util.HeaderRequestInterceptor Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
package io.mosip.pmp.partner.util;

import java.io.IOException;

import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;


public class HeaderRequestInterceptor implements ClientHttpRequestInterceptor {
    private final String headerName;
    private final String headerValue;
    public HeaderRequestInterceptor(String headerName, String headerValue) {
        this.headerName = headerName;
        this.headerValue = headerValue;
    }
    @Override
    public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
        request.getHeaders().set(headerName, headerValue);
        return execution.execute(request, body);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy